Index: pkg/template_binding/lib/js/patches_mdv.js |
diff --git a/pkg/template_binding/lib/js/patches_mdv.js b/pkg/template_binding/lib/js/patches_mdv.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0c49bfb14c4ed54dc4c8ebd69c15588cc7f1e2dc |
--- /dev/null |
+++ b/pkg/template_binding/lib/js/patches_mdv.js |
@@ -0,0 +1,58 @@ |
+/* |
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt |
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt |
+ * Code distributed by Google as part of the polymer project is also |
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
+ */ |
+ |
+(function(scope) { |
+ |
+// inject style sheet |
+var style = document.createElement('style'); |
+style.textContent = 'template {display: none !important;} /* injected by platform.js */'; |
+var head = document.querySelector('head'); |
+head.insertBefore(style, head.firstChild); |
+ |
+// flush (with logging) |
+var flushing; |
+function flush() { |
+ if (!flushing) { |
+ flushing = true; |
+ scope.endOfMicrotask(function() { |
+ flushing = false; |
+ logFlags.data && console.group('Platform.flush()'); |
+ scope.performMicrotaskCheckpoint(); |
+ logFlags.data && console.groupEnd(); |
+ }); |
+ } |
+}; |
+ |
+// polling dirty checker |
+// flush periodically if platform does not have object observe. |
+if (!Observer.hasObjectObserve) { |
+ var FLUSH_POLL_INTERVAL = 125; |
+ window.addEventListener('WebComponentsReady', function() { |
+ flush(); |
+ scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL); |
+ }); |
+} else { |
+ // make flush a no-op when we have Object.observe |
+ flush = function() {}; |
+} |
+ |
+if (window.CustomElements && !CustomElements.useNative) { |
+ var originalImportNode = Document.prototype.importNode; |
+ Document.prototype.importNode = function(node, deep) { |
+ var imported = originalImportNode.call(this, node, deep); |
+ CustomElements.upgradeAll(imported); |
+ return imported; |
+ } |
+} |
+ |
+// exports |
+scope.flush = flush; |
+ |
+})(window.Platform); |
+ |