trigger onload
Closed this issue · 2 comments
englishextra commented
function templatePolyfill() {
'use strict';
if ('content' in document.createElement('template')) {
return false;
}
var templates = document.getElementsByTagName('template');
var plateLen = templates.length;
for (var x = 0; x < plateLen; ++x) {
var template = templates[x];
var content = template.childNodes;
var fragment = document.createDocumentFragment();
while (content[0]) {
fragment.appendChild(content[0]);
}
template.content = fragment;
}
};
if (typeof exports === 'object') {
module.exports = templatePolyfill;
}
window.addEventListener("load", templatePolyfill);
jeffcarp commented
I don't think adding a global event listener is within the scope of this project. Modules depending on this polyfill are free to add their own event listeners.
englishextra commented
@jeffcarp that was a reminder for devs if they have script included onload which is a common behaviour nowadays