Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Unified Diff: pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js

Issue 23548014: update shadowdom polyfill to latest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated README, add build.sh Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.min.js ('k') | pkg/shadow_dom/tool/README.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cafb59787c8b4ed488c191d2fe42206574524abc..828a4fcde5e83adabcd5d50175a2462df1686b87 100644
--- a/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js
+++ b/pkg/shadow_dom/lib/src/platform/patches-shadowdom-polyfill.js
@@ -25,31 +25,34 @@
window.dartExperimentalFixupGetTag = function(originalGetTag) {
var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
- var isWrapper = ShadowDOMPolyfill.isWrapper;
- var unwrap = ShadowDOMPolyfill.unwrap;
+ var unwrapIfNeeded = ShadowDOMPolyfill.unwrapIfNeeded;
function getTag(obj) {
+ // TODO(jmesserly): do we still need these?
if (obj instanceof NodeList) return 'NodeList';
if (obj instanceof ShadowRoot) return 'ShadowRoot';
if (obj instanceof MutationRecord) return 'MutationRecord';
if (obj instanceof MutationObserver) return 'MutationObserver';
- if (isWrapper(obj)) {
- obj = unwrap(obj);
-
- // Fix up class names for Firefox. For some of them like
- // HTMLFormElement and HTMLInputElement, the "constructor" property of
- // the unwrapped nodes points at the wrapper for some reason.
- // TODO(jmesserly): figure out why this is happening.
+ var unwrapped = unwrapIfNeeded(obj);
+ if (obj !== unwrapped) {
+ // Fix up class names for Firefox.
+ // For some of them (like HTMLFormElement and HTMLInputElement),
+ // the "constructor" property of the unwrapped nodes points at the
+ // wrapper.
+ // Note: it is safe to check for the GeneratedWrapper string because
+ // we know it is some kind of Shadow DOM wrapper object.
Siggi Cherem (dart-lang) 2013/09/08 18:44:23 I thought this is safe in debug mode, but that in
var ctor = obj.constructor;
- if (ctor && ctor._ShadowDOMPolyfill$isGeneratedWrapper) {
+ if (ctor && ctor.name == 'GeneratedWrapper') {
var name = ctor._ShadowDOMPolyfill$cacheTag_;
if (!name) {
- name = Object.prototype.toString.call(obj);
+ name = Object.prototype.toString.call(unwrapped);
name = name.substring(8, name.length - 1);
ctor._ShadowDOMPolyfill$cacheTag_ = name;
}
return name;
}
+
+ obj = unwrapped;
}
return originalGetTag(obj);
}
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.min.js ('k') | pkg/shadow_dom/tool/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698