GoogleChromeLabs / GoogleChromeLabs/ui-element-samples

Advanced Router - DocumentFragment() not supported in Safari and Firefox?

Open
#57 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.1k
Forks
723
Avg merge
3m
Merged PRs (30d)
4

Description

I was having issues in Safari and Firefox when testing the Advanced Router. It wasn't firing the xhr but is was firing _showSpinner(). For some odd reason when I changed `new DocumentFragment()` to `document.createElement('div')` it works in all the browsers I tested.

I know that DocumentFragment has performance benefits so I attempted to do

```
if (new DocumentFragment()) {
this._view = new DocumentFragment();
}
else {
this._view = document.createElement('div');
}
```

This worked in Chrome but still didn't work in Safari or FF. It appears that [DocumentFragment is well supported](http://caniuse.com/#search=documentfragment) so I'm confused by the xhr won't fire in those browsers if DocumentFragment is being used. I've shown [here](https://github.com/derekshull/styleguide/blob/gh-pages/js/components.js#L116) where I've changed the code to work in the browsers. Anyone have a thought on why this occurs and possibly how to fix it?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.