diff --git a/.travis.yml b/.travis.yml index bafba95..a4f67bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,15 @@ language: node_js -sudo: false -node_js: 4 +sudo: required +dist: trusty +node_js: stable addons: sauce_connect: true firefox: latest apt: sources: - google-chrome - - ubuntu-toolchain-r-test packages: - google-chrome-stable - - g++-4.8 before_script: - export PATH=$PWD/node_modules/.bin:$PATH script: @@ -20,4 +19,3 @@ env: global: - secure: c0kVrjNDtqd06Gyg4Xi3iopr0KCz1k0LbZeL+TCbnyCdmAE7m9FcJASWvM2Zr7d774hTiMSi0Z79SlV6XZhLN2pi4EsbdEpsnVeAXXH/GYzDKgpXbdfD/nQv4n1nMXL6XSaZkAX7WwgmrjzJ9cXQJYV9vNHIBRcGoVRRyCFx9v4= - secure: Mo+AVRGUmlDENnZ2GioF5pU62WhyLUMnPlSqzeodZzJoAnwcNr9VnHiRCgQBLnHCZwjbMv6C0vhWopY7lN9w77vlS5vr8MDZKjYT/YRl9jk0+hStJ+diSS9MD+FnNNerXe+V+WA6NYVHno3vdWRqDDMYzCdH/pyLukkuKdMFaAU= - - CXX=g++-4.8 diff --git a/src/CustomElements/register.js b/src/CustomElements/register.js index 3a58bfe..e85eab4 100644 --- a/src/CustomElements/register.js +++ b/src/CustomElements/register.js @@ -350,27 +350,6 @@ function wrapDomMethodToForceUpgrade(obj, methodName) { wrapDomMethodToForceUpgrade(Node.prototype, 'cloneNode'); wrapDomMethodToForceUpgrade(document, 'importNode'); -// Patch document.importNode to work around IE11 bug that -// casues children of a document fragment imported while -// there is a mutation observer to not have a parentNode (!?!) -if (isIE) { - (function() { - var importNode = document.importNode; - document.importNode = function() { - var n = importNode.apply(document, arguments); - // Copy all children to a new document fragment since - // this one may be broken - if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) { - var f = document.createDocumentFragment(); - f.appendChild(n); - return f; - } else { - return n; - } - }; - })(); -} - // exports document.registerElement = register; document.createElement = createElement; // override diff --git a/src/Template/Template.js b/src/Template/Template.js index f393941..f43e72a 100644 --- a/src/Template/Template.js +++ b/src/Template/Template.js @@ -11,17 +11,38 @@ // minimal template polyfill (function() { var needsTemplate = (typeof HTMLTemplateElement === 'undefined'); + // NOTE: Patch document.importNode to work around IE11 bug that + // casues children of a document fragment imported while + // there is a mutation observer to not have a parentNode (!?!) + // This needs to happen *after* patching importNode to fix template cloning + if (/Trident/.test(navigator.userAgent)) { + (function() { + var importNode = document.importNode; + document.importNode = function() { + var n = importNode.apply(document, arguments); + // Copy all children to a new document fragment since + // this one may be broken + if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + var f = document.createDocumentFragment(); + f.appendChild(n); + return f; + } else { + return n; + } + }; + })(); + } - // returns true if nested templates can be cloned (they cannot be on + // returns true if nested templates cannot be cloned (they cannot be on // some impl's like Safari 8) var needsCloning = (function() { if (!needsTemplate) { - var frag = document.createDocumentFragment(); var t = document.createElement('template'); - frag.appendChild(t); - t.content.appendChild(document.createElement('div')); - var clone = frag.cloneNode(true); - return (clone.firstChild.content.childNodes.length === 0); + var t2 = document.createElement('template'); + t2.content.appendChild(document.createElement('div')); + t.content.appendChild(t2); + var clone = t.cloneNode(true); + return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0); } })(); @@ -42,7 +63,6 @@ /** Provides a minimal shim for the