| 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 2dc3b326f143c6f8022e67e3ee26d0eebf3dc7fa..a675aa7ff0a85ae664085def5c064ccac0022d1c 100644
|
| --- a/pkg/polymer/lib/src/build/polyfill_injector.dart
|
| +++ b/pkg/polymer/lib/src/build/polyfill_injector.dart
|
| @@ -38,7 +38,7 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
|
| detailsUri: 'http://goo.gl/5HPeuP');
|
| return readPrimaryAsHtml(transform, logger).then((document) {
|
| bool dartSupportFound = false;
|
| - Element platformJs;
|
| + Element webComponentsJs;
|
| Element dartJs;
|
| final dartScripts = <Element>[];
|
|
|
| @@ -46,8 +46,12 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
|
| var src = tag.attributes['src'];
|
| if (src != null) {
|
| var last = src.split('/').last;
|
| - if (_platformJS.hasMatch(last)) {
|
| - platformJs = tag;
|
| + if (_webComponentsJS.hasMatch(last)) {
|
| + webComponentsJs = tag;
|
| + } else if (_platformJS.hasMatch(last)) {
|
| + tag.attributes['src'] = src.replaceFirst(
|
| + _platformJS, 'webcomponents.min.js');
|
| + webComponentsJs = tag;
|
| } else if (_dartSupportJS.hasMatch(last)) {
|
| dartSupportFound = true;
|
| } else if (last == 'dart.js') {
|
| @@ -98,24 +102,24 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
|
| }
|
|
|
| // Inserts dart_support.js either at the top of the document or directly
|
| - // after platform.js if it exists.
|
| + // after webcomponents.js if it exists.
|
| if (!dartSupportFound) {
|
| - if (platformJs == null) {
|
| + if (webComponentsJs == null) {
|
| _addScriptFirst('web_components/dart_support.js');
|
| } else {
|
| - var parentsNodes = platformJs.parentNode.nodes;
|
| + var parentsNodes = webComponentsJs.parentNode.nodes;
|
| parentsNodes.insert(
|
| - parentsNodes.indexOf(platformJs) + 1,
|
| + parentsNodes.indexOf(webComponentsJs) + 1,
|
| parseFragment(
|
| '\n<script src="packages/web_components/dart_support.js">'
|
| '</script>'));
|
| }
|
| }
|
|
|
| - // By default platform.js should come before all other scripts.
|
| - if (platformJs == null && options.injectPlatformJs) {
|
| - var suffix = options.releaseMode ? '.js' : '.concat.js';
|
| - _addScriptFirst('web_components/platform$suffix');
|
| + // By default webcomponents.js should come before all other scripts.
|
| + if (webComponentsJs == null && options.injectWebComponentsJs) {
|
| + var suffix = options.releaseMode ? '.min.js' : '.js';
|
| + _addScriptFirst('web_components/webcomponents$suffix');
|
| }
|
|
|
| transform.addOutput(
|
| @@ -125,4 +129,6 @@ class PolyfillInjector extends Transformer with PolymerTransformer {
|
| }
|
|
|
| final _platformJS = new RegExp(r'platform.*\.js', caseSensitive: false);
|
| +final _webComponentsJS =
|
| + new RegExp(r'webcomponents.*\.js', caseSensitive: false);
|
| final _dartSupportJS = new RegExp(r'dart_support.js', caseSensitive: false);
|
|
|