Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Final phase of the polymer transformation: includes any additional polyfills | 6 * Final phase of the polymer transformation: includes any additional polyfills |
| 7 * that may needed by the deployed app. | 7 * that may needed by the deployed app. |
| 8 */ | 8 */ |
| 9 library polymer.src.build.polyfill_injector; | 9 library polymer.src.build.polyfill_injector; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 dartScriptTags = true; | 54 dartScriptTags = true; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (!dartScriptTags) { | 58 if (!dartScriptTags) { |
| 59 // This HTML has no Dart code, there is nothing to do here. | 59 // This HTML has no Dart code, there is nothing to do here. |
| 60 transform.addOutput(transform.primaryInput); | 60 transform.addOutput(transform.primaryInput); |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 if (!jsInteropFound) { | 64 _addScript(urlSegment) { |
| 65 // JS interop code is required for Polymer CSS shimming. | |
| 66 document.body.nodes.insert(0, parseFragment( | 65 document.body.nodes.insert(0, parseFragment( |
| 67 '<script src="packages/browser/interop.js"></script>\n')); | 66 '<script src="packages/$urlSegment"></script>\n')); |
| 68 } | 67 } |
| 69 | 68 |
| 69 // JS interop code is required for Polymer CSS shimming. | |
| 70 if (!jsInteropFound) _addScript('browser/interop.js'); | |
| 70 if (!customElementFound) { | 71 if (!customElementFound) { |
| 71 document.body.nodes.insert(0, parseFragment( | 72 _addScript('custom_element/custom-elements.debug.js'); |
| 72 '<script src="packages/custom_element/custom-elements.debug.js">' | |
| 73 '</script>\n')); | |
| 74 } | 73 } |
| 75 | 74 |
| 76 if (!shadowDomFound) { | 75 // This polyfill needs to be the first one on the body |
| 77 // Insert at the beginning (this polyfill needs to run as early as | 76 // TODO(jmesserly): this is .debug to workaround issue 13046. |
| 78 // possible). | 77 if (!shadowDomFound) _addScript('shadow_dom/shadow_dom.debug.js'); |
|
Jennifer Messerly
2013/10/17 02:04:35
if you want to fix: this can be .min now, 13046 is
Siggi Cherem (dart-lang)
2013/10/17 02:37:40
:-) funny I thought about fixing this too, but dec
| |
| 79 // TODO(jmesserly): this is .debug to workaround issue 13046. | |
| 80 document.body.nodes.insert(0, parseFragment( | |
| 81 '<script src="packages/shadow_dom/shadow_dom.debug.js"></script>\n') ); | |
| 82 } | |
| 83 | 78 |
| 84 transform.addOutput( | 79 transform.addOutput( |
| 85 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); | 80 new Asset.fromString(transform.primaryInput.id, document.outerHtml)); |
| 86 }); | 81 }); |
| 87 } | 82 } |
| 88 } | 83 } |
| 89 | 84 |
| 90 final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false); | 85 final _shadowDomJS = new RegExp(r'shadow_dom\..*\.js', caseSensitive: false); |
| 91 final _customElementJS = new RegExp(r'custom-elements\..*\.js', | 86 final _customElementJS = new RegExp(r'custom-elements\..*\.js', |
| 92 caseSensitive: false); | 87 caseSensitive: false); |
| OLD | NEW |