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

Unified Diff: runtime/bin/vmservice/observatory/deployed/web/packages/polymer/src/js/use_native_dartium_shadowdom.js

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/vmservice/observatory/deployed/web/packages/polymer/src/js/use_native_dartium_shadowdom.js
diff --git a/runtime/bin/vmservice/observatory/deployed/web/packages/polymer/src/js/use_native_dartium_shadowdom.js b/runtime/bin/vmservice/observatory/deployed/web/packages/polymer/src/js/use_native_dartium_shadowdom.js
new file mode 100644
index 0000000000000000000000000000000000000000..7b492b79bad1088d5d1cb7b95985064da95929f0
--- /dev/null
+++ b/runtime/bin/vmservice/observatory/deployed/web/packages/polymer/src/js/use_native_dartium_shadowdom.js
@@ -0,0 +1,29 @@
+// Prevent polyfilled JS Shadow DOM in Dartium
+// We need this if we want Dart code to be able to interoperate with Polymer.js
+// code that also uses Shadow DOM.
+// TODO(jmesserly): we can remove this code once platform.js is correctly
+// feature detecting Shadow DOM in Dartium.
+if (navigator.userAgent.indexOf('(Dart)') !== -1) {
+ window.Platform = window.Platform || {};
+ Platform.flags = Platform.flags || {};
+ Platform.flags.shadow = 'native';
+
+ // Note: Dartium 34 hasn't turned on the unprefixed Shadow DOM
+ // (this happens in Chrome 35), so unless "enable experimental platform
+ // features" is enabled, things will break. So we expose them as unprefixed
+ // names instead.
+ var proto = Element.prototype;
+ if (!proto.createShadowRoot) {
+ proto.createShadowRoot = proto.webkitCreateShadowRoot;
+
+ Object.defineProperty(proto, 'shadowRoot', {
+ get: function() {
+ return this.webkitShadowRoot;
+ },
+ set: function(value) {
+ this.webkitShadowRoot = value;
+ },
+ configurable: true
+ });
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698