| OLD | NEW |
| (Empty) |
| 1 // Prevent polyfilled JS Shadow DOM in Dartium | |
| 2 // We need this if we want Dart code to be able to interoperate with Polymer.js | |
| 3 // code that also uses Shadow DOM. | |
| 4 // TODO(jmesserly): we can remove this code once platform.js is correctly | |
| 5 // feature detecting Shadow DOM in Dartium. | |
| 6 if (navigator.userAgent.indexOf('(Dart)') !== -1) { | |
| 7 window.Platform = window.Platform || {}; | |
| 8 Platform.flags = Platform.flags || {}; | |
| 9 Platform.flags.shadow = 'native'; | |
| 10 | |
| 11 // Note: Dartium 34 hasn't turned on the unprefixed Shadow DOM | |
| 12 // (this happens in Chrome 35), so unless "enable experimental platform | |
| 13 // features" is enabled, things will break. So we expose them as unprefixed | |
| 14 // names instead. | |
| 15 var proto = Element.prototype; | |
| 16 if (!proto.createShadowRoot) { | |
| 17 proto.createShadowRoot = proto.webkitCreateShadowRoot; | |
| 18 | |
| 19 Object.defineProperty(proto, 'shadowRoot', { | |
| 20 get: function() { | |
| 21 return this.webkitShadowRoot; | |
| 22 }, | |
| 23 set: function(value) { | |
| 24 this.webkitShadowRoot = value; | |
| 25 }, | |
| 26 configurable: true | |
| 27 }); | |
| 28 } | |
| 29 } | |
| OLD | NEW |