Переглянути джерело

template element polyfill

Heydon Pickering 8 роки тому
батько
коміт
f0f2c8b7ce

+ 27 - 0
docs/js/dom-scripts.js

@@ -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);

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
docs/service-worker.js


+ 27 - 0
themes/infusion/static/js/dom-scripts.js

@@ -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);

Деякі файли не було показано, через те що забагато файлів було змінено