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

Unified Diff: pkg/polymer/lib/polymer_element.dart

Issue 22801009: Bring the rest of the polymer.dart code from github. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/lib/polymer.dart ('k') | pkg/polymer/lib/src/emitters.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/polymer_element.dart
diff --git a/pkg/polymer/lib/polymer_element.dart b/pkg/polymer/lib/polymer_element.dart
index 141a50d73c46c74622c5f414a1149039ae805449..297625e5a5e76930d97c5508e05c3f3da003fa8b 100644
--- a/pkg/polymer/lib/polymer_element.dart
+++ b/pkg/polymer/lib/polymer_element.dart
@@ -7,6 +7,7 @@ library polymer.polymer_element;
import 'dart:async';
import 'dart:html';
import 'dart:mirrors';
+import 'dart:js' as dartJs;
import 'package:custom_element/custom_element.dart';
import 'package:js/js.dart' as js;
@@ -174,10 +175,20 @@ class PolymerElement extends CustomElement with _EventsMixin {
* Using Polymer's platform/src/ShadowCSS.js passing the style tag's content.
*/
void _shimCss(ShadowRoot root, String localName, String extendsName) {
- // TODO(terry): Remove warning, cast js.context to dynamic because of bug
- // https://code.google.com/p/dart/issues/detail?id=6111. The
- // js interop package will be patching this until bug is fixed.
- var platform = (js.context as dynamic).Platform;
+ // TODO(terry): Need to detect if ShadowCSS.js has been loaded. Under
+ // Dartium this wouldn't exist. However, dart:js isn't robust
+ // to use to detect in both Dartium and dart2js if Platform is
+ // defined. Instead in Dartium it throws an exception but in
+ // dart2js it works enough to know if Platform is defined (just
+ // can't be used for further derefs). This bug is described
+ // https://code.google.com/p/dart/issues/detail?id=12548
+ // When fixed only use dart:js. This is necessary under
+ // Dartium (no compile) we want to run w/o the JS polyfill.
+ try {
+ if (dartJs.context["Platform"] == null) { return; }
+ } on NoSuchMethodError catch (e) { return; }
+
+ var platform = js.context["Platform"];
if (platform == null) return;
var shadowCss = platform.ShadowCSS;
if (shadowCss == null) return;
« no previous file with comments | « pkg/polymer/lib/polymer.dart ('k') | pkg/polymer/lib/src/emitters.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698