| OLD | NEW |
| 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 Loading... |
| 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 })(); |
| OLD | NEW |