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

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

Issue 24129004: fix shadowdom polyfill (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.min.js ('k') | pkg/shadow_dom/tool/build.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Polymer Authors. All rights reserved. 2 * Copyright 2013 The Polymer Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style 3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file. 4 * license that can be found in the LICENSE file.
5 */ 5 */
6 (function() { 6 (function() {
7 var ShadowDOMPolyfill = window.ShadowDOMPolyfill; 7 var ShadowDOMPolyfill = window.ShadowDOMPolyfill;
8 var wrap = ShadowDOMPolyfill.wrap; 8 var wrap = ShadowDOMPolyfill.wrap;
9 9
10 // patch in prefixed name 10 // patch in prefixed name
(...skipping 20 matching lines...) Expand all
31 if (obj instanceof NodeList) return 'NodeList'; 31 if (obj instanceof NodeList) return 'NodeList';
32 if (obj instanceof ShadowRoot) return 'ShadowRoot'; 32 if (obj instanceof ShadowRoot) return 'ShadowRoot';
33 if (obj instanceof MutationRecord) return 'MutationRecord'; 33 if (obj instanceof MutationRecord) return 'MutationRecord';
34 if (obj instanceof MutationObserver) return 'MutationObserver'; 34 if (obj instanceof MutationObserver) return 'MutationObserver';
35 35
36 var unwrapped = unwrapIfNeeded(obj); 36 var unwrapped = unwrapIfNeeded(obj);
37 if (obj !== unwrapped) { 37 if (obj !== unwrapped) {
38 // Fix up class names for Firefox. 38 // Fix up class names for Firefox.
39 // For some of them (like HTMLFormElement and HTMLInputElement), 39 // For some of them (like HTMLFormElement and HTMLInputElement),
40 // the "constructor" property of the unwrapped nodes points at the 40 // the "constructor" property of the unwrapped nodes points at the
41 // wrapper. 41 // same constructor as the wrapper.
42 // Note: it is safe to check for the GeneratedWrapper string because 42 var ctor = obj.constructor
43 // we know it is some kind of Shadow DOM wrapper object. 43 if (ctor === unwrapped.constructor) {
44 var ctor = obj.constructor;
45 if (ctor && ctor.name == 'GeneratedWrapper') {
46 var name = ctor._ShadowDOMPolyfill$cacheTag_; 44 var name = ctor._ShadowDOMPolyfill$cacheTag_;
47 if (!name) { 45 if (!name) {
48 name = Object.prototype.toString.call(unwrapped); 46 name = Object.prototype.toString.call(unwrapped);
49 name = name.substring(8, name.length - 1); 47 name = name.substring(8, name.length - 1);
50 ctor._ShadowDOMPolyfill$cacheTag_ = name; 48 ctor._ShadowDOMPolyfill$cacheTag_ = name;
51 } 49 }
52 return name; 50 return name;
53 } 51 }
54 52
55 obj = unwrapped; 53 obj = unwrapped;
56 } 54 }
57 return originalGetTag(obj); 55 return originalGetTag(obj);
58 } 56 }
59 57
60 return getTag; 58 return getTag;
61 }; 59 };
62 })(); 60 })();
OLDNEW
« no previous file with comments | « pkg/shadow_dom/lib/shadow_dom.min.js ('k') | pkg/shadow_dom/tool/build.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698