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

Side by Side Diff: pkg/shadow_dom/lib/shadow_dom.debug.js

Issue 22403005: [pkg:shadow_dom] workaround issue in ownerDocument (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « no previous file | pkg/shadow_dom/lib/shadow_dom.min.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 if ((!HTMLElement.prototype.createShadowRoot && 1 if ((!HTMLElement.prototype.createShadowRoot &&
2 !HTMLElement.prototype.webkitCreateShadowRoot) || 2 !HTMLElement.prototype.webkitCreateShadowRoot) ||
3 window.__forceShadowDomPolyfill) { 3 window.__forceShadowDomPolyfill) {
4 4
5 /* 5 /*
6 * Copyright 2013 The Polymer Authors. All rights reserved. 6 * Copyright 2013 The Polymer Authors. All rights reserved.
7 * Use of this source code is governed by a BSD-style 7 * Use of this source code is governed by a BSD-style
8 * license that can be found in the LICENSE file. 8 * license that can be found in the LICENSE file.
9 */ 9 */
10 (function() { 10 (function() {
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 var parentNode = child.parentNode; 1430 var parentNode = child.parentNode;
1431 if (!parentNode) 1431 if (!parentNode)
1432 return false; 1432 return false;
1433 return this.contains(parentNode); 1433 return this.contains(parentNode);
1434 }, 1434 },
1435 1435
1436 compareDocumentPosition: function(otherNode) { 1436 compareDocumentPosition: function(otherNode) {
1437 // This only wraps, it therefore only operates on the composed DOM and not 1437 // This only wraps, it therefore only operates on the composed DOM and not
1438 // the logical DOM. 1438 // the logical DOM.
1439 return originalCompareDocumentPosition.call(this.impl, unwrap(otherNode)); 1439 return originalCompareDocumentPosition.call(this.impl, unwrap(otherNode));
1440 },
1441
1442 // TODO(jmesserly): this is a workaround for
1443 // https://github.com/Polymer/ShadowDOM/issues/200
1444 get ownerDocument() {
1445 scope.renderAllPending();
1446 return wrap(this.impl.ownerDocument);
1440 } 1447 }
1441 }); 1448 });
1442 1449
1443 defineWrapGetter(Node, 'ownerDocument'); 1450 // TODO(jmesserly): this is commented out to workaround:
1451 // https://github.com/Polymer/ShadowDOM/issues/200
1452 //defineWrapGetter(Node, 'ownerDocument');
1444 1453
1445 // We use a DocumentFragment as a base and then delete the properties of 1454 // We use a DocumentFragment as a base and then delete the properties of
1446 // DocumentFragment.prototype from the wrapper Node. Since delete makes 1455 // DocumentFragment.prototype from the wrapper Node. Since delete makes
1447 // objects slow in some JS engines we recreate the prototype object. 1456 // objects slow in some JS engines we recreate the prototype object.
1448 registerWrapper(OriginalNode, Node, document.createDocumentFragment()); 1457 registerWrapper(OriginalNode, Node, document.createDocumentFragment());
1449 delete Node.prototype.querySelector; 1458 delete Node.prototype.querySelector;
1450 delete Node.prototype.querySelectorAll; 1459 delete Node.prototype.querySelectorAll;
1451 Node.prototype = mixin(Object.create(EventTarget.prototype), Node.prototype); 1460 Node.prototype = mixin(Object.create(EventTarget.prototype), Node.prototype);
1452 1461
1453 scope.wrappers.Node = Node; 1462 scope.wrappers.Node = Node;
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 } 3198 }
3190 } 3199 }
3191 return originalGetTag(obj); 3200 return originalGetTag(obj);
3192 } 3201 }
3193 3202
3194 return getTag; 3203 return getTag;
3195 }; 3204 };
3196 })(); 3205 })();
3197 3206
3198 } 3207 }
OLDNEW
« 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