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

Side by Side Diff: pkg/custom_element/lib/custom-elements.debug.js

Issue 26558008: Adding platform patches to allow custom elements polyfill to work with Shadow DOM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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/custom_element/lib/custom-elements.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 // Copyright (c) 2012 The Polymer Authors. All rights reserved. 1 // Copyright (c) 2012 The Polymer Authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 // https://github.com/Polymer/platform/blob/master/src/patches-shadowdom-polyfil l.js 1429 // https://github.com/Polymer/platform/blob/master/src/patches-shadowdom-polyfil l.js
1430 // include .host reference 1430 // include .host reference
1431 if (HTMLElement.prototype.createShadowRoot) { 1431 if (HTMLElement.prototype.createShadowRoot) {
1432 var originalCreateShadowRoot = HTMLElement.prototype.createShadowRoot; 1432 var originalCreateShadowRoot = HTMLElement.prototype.createShadowRoot;
1433 HTMLElement.prototype.createShadowRoot = function() { 1433 HTMLElement.prototype.createShadowRoot = function() {
1434 var root = originalCreateShadowRoot.call(this); 1434 var root = originalCreateShadowRoot.call(this);
1435 root.host = this; 1435 root.host = this;
1436 return root; 1436 return root;
1437 } 1437 }
1438 } 1438 }
1439
1440
1441 // Patch to allow custom elements and shadow dom to work together, from:
1442 // https://github.com/Polymer/platform/blob/master/src/patches-custom-elements.j s
1443 if (window.ShadowDOMPolyfill) {
1444 function nop() {};
1445
1446 // disable shadow dom watching
1447 CustomElements.watchShadow = nop;
1448 CustomElements.watchAllShadows = nop;
1449
1450 // ensure wrapped inputs for these functions
1451 var fns = ['upgradeAll', 'upgradeSubtree', 'observeDocument',
1452 'upgradeDocument'];
1453
1454 // cache originals
1455 var original = {};
1456 fns.forEach(function(fn) {
1457 original[fn] = CustomElements[fn];
1458 });
1459
1460 // override
1461 fns.forEach(function(fn) {
1462 CustomElements[fn] = function(inNode) {
1463 return original[fn](ShadowDOMPolyfill.wrapIfNeeded(inNode));
1464 };
1465 });
1466 }
1467
1439 })(); 1468 })();
OLDNEW
« no previous file with comments | « no previous file | pkg/custom_element/lib/custom-elements.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698