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

Unified Diff: pkg/polymer/lib/src/build/polyfill_injector.dart

Issue 26051002: Updating Polymer to derive from custom elements. (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 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/declaration.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/build/polyfill_injector.dart
diff --git a/pkg/polymer/lib/src/build/polyfill_injector.dart b/pkg/polymer/lib/src/build/polyfill_injector.dart
index d0e81ee385db018e4c2eb1cc76ab781ab8796e6f..b8a5afc9448b57e99e3d1d872159682654e93841 100644
--- a/pkg/polymer/lib/src/build/polyfill_injector.dart
+++ b/pkg/polymer/lib/src/build/polyfill_injector.dart
@@ -34,6 +34,7 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
return readPrimaryAsHtml(transform).then((document) {
bool shadowDomFound = false;
bool jsInteropFound = false;
+ bool customElementFound = false;
bool dartScriptTags = false;
for (var tag in document.queryAll('script')) {
@@ -44,6 +45,8 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
jsInteropFound = true;
} else if (_shadowDomJS.hasMatch(last)) {
shadowDomFound = true;
+ } else if (_customElementJS.hasMatch(last)) {
+ customElementFound = true;
}
}
@@ -64,6 +67,12 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
'<script src="packages/browser/interop.js"></script>\n'));
}
+ if (!customElementFound) {
+ document.body.nodes.insert(0, parseFragment(
+ '<script src="packages/custom_element/custom-elements.debug.js">'
+ '</script>\n'));
+ }
+
if (!shadowDomFound) {
// Insert at the beginning (this polyfill needs to run as early as
// possible).
@@ -79,3 +88,5 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
}
final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false);
+final _customElementJS = new RegExp(r'custom-elements\..*\.js',
+ caseSensitive: false);
« no previous file with comments | « pkg/polymer/lib/polymer.dart ('k') | pkg/polymer/lib/src/declaration.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698