Resolve IE11 bug with documentFragment.children

This commit is contained in:
Josh Johnson 2016-08-17 14:00:30 +01:00
parent d099c17f68
commit f201b6cd09
4 changed files with 6 additions and 8 deletions

View file

@ -16,7 +16,7 @@
"no-underscore-dangle": "off",
"no-new": 0,
"max-len": "off",
"no-console": ["error", { allow: ["warn", "error"] }],
"no-console": "off",
"consistent-return": "off",
"no-param-reassign": ["error", { "props": false }],
"no-unused-vars": ["error", { "args": "none" }]

File diff suppressed because one or more lines are too long

View file

@ -10,7 +10,6 @@ import {
addGroup,
clearAll,
} from './actions/index';
import {
isScrolledIntoView,
getAdjacentEl,
@ -1917,7 +1916,6 @@ export default class Choices {
items.forEach((item) => {
// Create new list element
const listItem = this._getTemplate('item', item);
// Append it to list
itemListFragment.appendChild(listItem);
});
@ -1936,7 +1934,7 @@ export default class Choices {
// Only render if our state has actually changed
if (this.currentState !== this.prevState) {
// Choices
if ((this.currentState.choices !== this.prevState.choices || this.currentState.groups !== this.prevState.groups)) {
if (this.currentState.choices !== this.prevState.choices || this.currentState.groups !== this.prevState.groups) {
if (this.passedElement.type === 'select-multiple' || this.passedElement.type === 'select-one') {
// Get active groups/choices
const activeGroups = this.store.getGroupsFilteredByActive();
@ -1981,7 +1979,7 @@ export default class Choices {
this.itemList.innerHTML = '';
// If we have items to add
if (itemListFragment.children && itemListFragment.children.length) {
if (itemListFragment.childNodes) {
// Update list
this.itemList.appendChild(itemListFragment);
}

View file

@ -16,7 +16,7 @@
<!-- Ignore these -->
<link rel="stylesheet" href="assets/styles/css/base.min.css?version=1.1.2">
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/1.0.0/fetch.min.js"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,matchMedia,fetch,Element.prototype.placeholder,Array.prototype.includes"></script>
<!-- End ignore these -->
<!-- Choices includes -->