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

Unified Diff: pkg/shadow_dom/lib/shadow_dom.debug.js

Issue 19581004: Update shadow_dom package with latest changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « no previous file | pkg/shadow_dom/lib/shadow_dom.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/shadow_dom/lib/shadow_dom.debug.js
diff --git a/pkg/shadow_dom/lib/shadow_dom.debug.js b/pkg/shadow_dom/lib/shadow_dom.debug.js
index dc87a193258414d10a8c251a575cc418c40f7f0f..bd4252dead488cf946bbb3c4aafd425cdc058061 100644
--- a/pkg/shadow_dom/lib/shadow_dom.debug.js
+++ b/pkg/shadow_dom/lib/shadow_dom.debug.js
@@ -232,6 +232,10 @@ var ShadowDOMPolyfill = {};
GeneratedWrapper.prototype =
Object.create(superWrapperConstructor.prototype);
GeneratedWrapper.prototype.constructor = GeneratedWrapper;
+ // We add this property to work around a Firefox bug where HTMLFormElement
+ // and HTMLInputElements sometimes have their constructor incorrectly
+ // attached to GeneratedWrapper. See lib/patches-shadowdom-polyfill.js
+ GeneratedWrapper._ShadowDOMPolyfill$isGeneratedWrapper = true;
return GeneratedWrapper;
}
@@ -367,6 +371,7 @@ var ShadowDOMPolyfill = {};
scope.wrappers = wrappers;
})(this.ShadowDOMPolyfill);
+
// Copyright 2013 The Polymer Authors. All rights reserved.
// Use of this source code is goverened by a BSD-style
// license that can be found in the LICENSE file.
@@ -3153,69 +3158,41 @@ var ShadowDOMPolyfill = {};
HTMLElement.prototype.webkitCreateShadowRoot =
HTMLElement.prototype.createShadowRoot;
- // TODO(jmesserly): figure out what to do about these Dart-specific patches
- // Right now it depends on some dart2js impl details to patch getTypeNameOf
// TODO(jmesserly): we need to wrap document somehow (a dart:html hook?)
- window.dartMainRunner = function(main) {
+ window.dartExperimentalFixupGetTag = function(originalGetTag) {
var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
var isWrapper = ShadowDOMPolyfill.isWrapper;
var unwrap = ShadowDOMPolyfill.unwrap;
- var innerTypeNameOf = window.$.getFunctionForTypeNameOf();
-
- function typeNameOfShadowDOM(obj) {
- var result;
- if (obj instanceof NodeList) {
- result = 'NodeList';
- } else if (obj instanceof ShadowRoot) {
- result = 'ShadowRoot';
- } else if (obj instanceof MutationRecord) {
- result = 'MutationRecord';
- } else if (obj instanceof MutationObserver) {
- result = 'MutationObserver';
- } else {
- 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 ctor = obj.constructor;
- if (ctor && !ctor.builtin$cls && ctor.name == 'GeneratedWrapper') {
- var name = Object.prototype.toString.call(obj);
+ function getTag(obj) {
+ 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 ctor = obj.constructor;
+ if (ctor && ctor._ShadowDOMPolyfill$isGeneratedWrapper) {
+ var name = ctor._ShadowDOMPolyfill$cacheTag_;
+ if (!name) {
+ name = Object.prototype.toString.call(obj);
name = name.substring(8, name.length - 1);
- ctor.builtin$cls = name;
+ ctor._ShadowDOMPolyfill$cacheTag_ = name;
}
+ return name;
}
-
- result = innerTypeNameOf.call$1(obj);
}
-
- return result;
+ return originalGetTag(obj);
}
- function constructorNameShadowDOM(object) {
- var $constructor, $name, string;
- if (object == null)
- return "Null";
- $constructor = object.constructor;
- if (typeof $constructor === "function") {
- $name = $constructor.builtin$cls;
- if ($name != null)
- return $name;
- }
-
- }
-
- window.$.constructorNameFallback = constructorNameShadowDOM;
- window.$._getTypeNameOf = { call$1: typeNameOfShadowDOM };
- window.Isolate.$isolateProperties._getTypeNameOf = window.$._getTypeNameOf;
-
- // Invoke the real main
- main();
+ return getTag;
};
-
})();
}
« no previous file with comments | « no previous file | pkg/shadow_dom/lib/shadow_dom.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698