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

Unified Diff: pkg/web_components/lib/dart_support.js

Issue 282893002: Use originalGetTag on wrapped object (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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/pkg.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/web_components/lib/dart_support.js
diff --git a/pkg/web_components/lib/dart_support.js b/pkg/web_components/lib/dart_support.js
index 44b5a38cad1912c75ad8e8b5be586d05e845aa86..503faeeec9b3010c332c0bc153d112cc8d2c1885 100644
--- a/pkg/web_components/lib/dart_support.js
+++ b/pkg/web_components/lib/dart_support.js
@@ -15,11 +15,18 @@
var needsConstructorFix = window.constructor === window.Window;
// TODO(jmesserly): we need to wrap document somehow (a dart:html hook?)
- window.dartExperimentalFixupGetTag = function(originalGetTag) {
+
+ // dartNativeDispatchHooksTransformer is described on initHooks() in
+ // sdk/lib/_internal/lib/native_helper.dart.
+ if (typeof window.dartNativeDispatchHooksTransformer == 'undefined')
+ window.dartNativeDispatchHooksTransformer = [];
+
+ window.dartNativeDispatchHooksTransformer.push(function(hooks) {
var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
var unwrapIfNeeded = ShadowDOMPolyfill.unwrapIfNeeded;
- function getTag(obj) {
+ var originalGetTag = hooks.getTag;
+ hooks.getTag = function getTag(obj) {
// TODO(jmesserly): do we still need these?
if (obj instanceof NodeList) return 'NodeList';
if (obj instanceof ShadowRoot) return 'ShadowRoot';
@@ -44,8 +51,7 @@
if (ctor === unwrapped.constructor) {
var name = ctor._ShadowDOMPolyfill$cacheTag_;
if (!name) {
- name = Object.prototype.toString.call(unwrapped);
- name = name.substring(8, name.length - 1);
+ name = originalGetTag(unwrapped);
Jennifer Messerly 2014/05/13 21:01:31 Interesting! Do we still need ctor._ShadowDOMPolyf
Siggi Cherem (dart-lang) 2014/05/13 21:06:58 +1, lgtm, if we don't need the caching, I'm happy
Siggi Cherem (dart-lang) 2014/05/13 21:55:21 FYI - we chatted more about it offline and decided
Jennifer Messerly 2014/05/13 22:12:36 interesting. yeah, seems okay, but makes me wonder
ctor._ShadowDOMPolyfill$cacheTag_ = name;
}
return name;
@@ -55,7 +61,5 @@
}
return originalGetTag(obj);
}
-
- return getTag;
- };
+ });
})();
« no previous file with comments | « pkg/pkg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698