Index: pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js |
diff --git a/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js b/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js |
index 1b0014cf0e0fabe4b8a256552ea4d2142cece750..4bc5a56318356ed5ef132910a0a5a60eb364af3a 100644 |
--- a/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js |
+++ b/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js |
@@ -35,6 +35,13 @@ |
if (window.MutationObserver && (obj instanceof MutationObserver)) |
return 'MutationObserver'; |
+ // TODO(jmesserly): this prevents incorrect interaction between ShadowDOM |
+ // and dart:html's <template> polyfill. Essentially, ShadowDOM is |
+ // polyfilling native template, but our Dart polyfill fails to detect this |
+ // because the unwrapped node is an HTMLUnknownElement, leading it to |
+ // think the node has no content. |
+ if (obj instanceof HTMLTemplateElement) return 'HTMLTemplateElement'; |
+ |
var unwrapped = unwrapIfNeeded(obj); |
if (obj !== unwrapped) { |
// Fix up class names for Firefox. |