@webcomponents/webcomponentsjs
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0-beta.3
@@ -34,3 +34,6 @@ /** | ||
window.addEventListener('DOMContentLoaded', () => { | ||
function flushAndFire() { | ||
if (window.HTMLTemplateElement.bootstrap) { | ||
window.HTMLTemplateElement.bootstrap(window.document); | ||
} | ||
flusher && flusher(); | ||
@@ -40,2 +43,13 @@ shouldFlush = true; | ||
document.dispatchEvent(new CustomEvent('WebComponentsReady', { bubbles: true })); | ||
}); | ||
} | ||
if (document.readyState !== 'complete') { | ||
// this script may come between DCL and load, so listen for both, and cancel load listener if DCL fires | ||
window.addEventListener('load', flushAndFire) | ||
window.addEventListener('DOMContentLoaded', () => { | ||
window.removeEventListener('load', flushAndFire); | ||
flushAndFire(); | ||
}); | ||
} else { | ||
flushAndFire(); | ||
} |
@@ -25,2 +25,3 @@ /** | ||
import '../node_modules/@webcomponents/url/url.js'; | ||
import '../src/symbol.js'; | ||
import '../src/unresolved.js'; |
@@ -70,2 +70,3 @@ /** | ||
dependency_mode: 'STRICT', | ||
process_common_js_modules: true, | ||
externs: [ | ||
@@ -82,2 +83,3 @@ 'externs/webcomponents.js', | ||
'src/*.js', | ||
'node_modules/es-symbol/**/*.js', | ||
'node_modules/es6-promise/lib/es6-promise/**/*.js', | ||
@@ -84,0 +86,0 @@ 'node_modules/@webcomponents/**/*.js', |
{ | ||
"name": "@webcomponents/webcomponentsjs", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0-beta.3", | ||
"description": "Web Components Polyfills", | ||
@@ -40,2 +40,3 @@ "main": "webcomponents-lite.js", | ||
"del": "^3.0.0", | ||
"es-symbol": "^1.1.2", | ||
"es6-promise": "4.1.x", | ||
@@ -51,7 +52,6 @@ "eslint": "^4.19.1", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
"run-sequence": "^2.2.1", | ||
"vinyl-buffer": "^1.0.1", | ||
"wct-browser-legacy": "0.0.1-pre.12", | ||
"web-component-tester": "^6.6.0-pre.5" | ||
"wct-browser-legacy": "^1.0.0", | ||
"web-component-tester": "^6.6.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "publishConfig": { |
@@ -117,7 +117,25 @@ /** | ||
} | ||
var needsTemplate = (function() { | ||
// no real <template> because no `content` property (IE and older browsers) | ||
var t = document.createElement('template'); | ||
if (!('content' in t)) { | ||
return true; | ||
} | ||
// broken doc fragment (older Edge) | ||
if (!(t.content.cloneNode() instanceof DocumentFragment)) { | ||
return true; | ||
} | ||
// broken <template> cloning (Edge up to at least version 17) | ||
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); | ||
})(); | ||
// NOTE: any browser that does not have template or ES6 features | ||
// must load the full suite of polyfills. | ||
if (!('content' in document.createElement('template')) || !window.Promise || !Array.from || !window.URL || | ||
// Edge has broken fragment cloning which means you cannot clone template.content | ||
!(document.createDocumentFragment().cloneNode() instanceof DocumentFragment)) { | ||
if (!window.Promise || !Array.from || !window.URL || !window.Symbol || needsTemplate) { | ||
polyfills = ['sd-ce-pf']; | ||
@@ -153,5 +171,10 @@ } | ||
} else { | ||
window.addEventListener('DOMContentLoaded', ready) | ||
// this script may come between DCL and load, so listen for both, and cancel load listener if DCL fires | ||
window.addEventListener('load', ready); | ||
window.addEventListener('DOMContentLoaded', function() { | ||
window.removeEventListener('load', ready); | ||
ready(); | ||
}) | ||
} | ||
} | ||
})(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2425035
81
2575