template element polyfill
This commit is contained in:
parent
718fd3e67a
commit
f0f2c8b7ce
|
@ -130,3 +130,30 @@
|
|||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/* Template element polyfill */
|
||||
(function templatePolyfill(d) {
|
||||
if('content' in d.createElement('template')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var qPlates = d.getElementsByTagName('template'),
|
||||
plateLen = qPlates.length,
|
||||
elPlate,
|
||||
qContent,
|
||||
contentLen,
|
||||
docContent;
|
||||
|
||||
for(var x=0; x<plateLen; ++x) {
|
||||
elPlate = qPlates[x];
|
||||
qContent = elPlate.childNodes;
|
||||
contentLen = qContent.length;
|
||||
docContent = d.createDocumentFragment();
|
||||
|
||||
while(qContent[0]) {
|
||||
docContent.appendChild(qContent[0]);
|
||||
}
|
||||
|
||||
elPlate.content = docContent;
|
||||
}
|
||||
})(document);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -130,3 +130,30 @@
|
|||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/* Template element polyfill */
|
||||
(function templatePolyfill(d) {
|
||||
if('content' in d.createElement('template')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var qPlates = d.getElementsByTagName('template'),
|
||||
plateLen = qPlates.length,
|
||||
elPlate,
|
||||
qContent,
|
||||
contentLen,
|
||||
docContent;
|
||||
|
||||
for(var x=0; x<plateLen; ++x) {
|
||||
elPlate = qPlates[x];
|
||||
qContent = elPlate.childNodes;
|
||||
contentLen = qContent.length;
|
||||
docContent = d.createDocumentFragment();
|
||||
|
||||
while(qContent[0]) {
|
||||
docContent.appendChild(qContent[0]);
|
||||
}
|
||||
|
||||
elPlate.content = docContent;
|
||||
}
|
||||
})(document);
|
||||
|
|
Loading…
Reference in New Issue
Block a user