| 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 /** Transfomer that inlines polymer-element definitions from html imports. */ | 5 /** Transfomer that inlines polymer-element definitions from html imports. */ | 
| 6 library polymer.src.transform.import_inliner; | 6 library polymer.src.transform.import_inliner; | 
| 7 | 7 | 
| 8 import 'dart:async'; | 8 import 'dart:async'; | 
| 9 | 9 | 
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; | 
| 11 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; | 
| 12 import 'package:html5lib/dom.dart' show Document, Node, DocumentFragment; | 12 import 'package:html5lib/dom.dart' show Document, Node, DocumentFragment; | 
| 13 import 'package:html5lib/dom_parsing.dart' show TreeVisitor; | 13 import 'package:html5lib/dom_parsing.dart' show TreeVisitor; | 
| 14 import 'common.dart'; | 14 import 'common.dart'; | 
| 15 | 15 | 
| 16 /** Recursively inlines polymer-element definitions from html imports. */ | 16 /** Recursively inlines polymer-element definitions from html imports. */ | 
| 17 // TODO(sigmund): make sure we match semantics of html-imports for tags other | 17 // TODO(sigmund): make sure we match semantics of html-imports for tags other | 
| 18 // than polymer-element (see dartbug.com/12613). | 18 // than polymer-element (see dartbug.com/12613). | 
| 19 class ImportedElementInliner extends Transformer { | 19 class ImportedElementInliner extends Transformer with PolymerTransformer { | 
|  | 20   final TransformOptions options; | 
|  | 21 | 
|  | 22   ImportedElementInliner(this.options); | 
|  | 23 | 
| 20   /** Only run on entry point .html files. */ | 24   /** Only run on entry point .html files. */ | 
| 21   Future<bool> isPrimary(Asset input) => | 25   Future<bool> isPrimary(Asset input) => | 
| 22       new Future.value(isPrimaryHtml(input.id)); | 26       new Future.value(options.isHtmlEntrypoint(input.id)); | 
| 23 | 27 | 
| 24   Future apply(Transform transform) { | 28   Future apply(Transform transform) { | 
| 25     var seen = new Set<AssetId>(); | 29     var seen = new Set<AssetId>(); | 
| 26     var elements = []; | 30     var elements = []; | 
| 27     var id = transform.primaryInput.id; | 31     var id = transform.primaryInput.id; | 
| 28     seen.add(id); | 32     seen.add(id); | 
| 29     return readPrimaryAsHtml(transform).then((document) { | 33     return readPrimaryAsHtml(transform).then((document) { | 
| 30       var future = _visitImports(document, id, transform, seen, elements); | 34       var future = _visitImports(document, id, transform, seen, elements); | 
| 31       return future.then((importsFound) { | 35       return future.then((importsFound) { | 
| 32         if (!importsFound) { | 36         if (!importsFound) { | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 159   'cite',       // in blockquote, del, ins, q | 163   'cite',       // in blockquote, del, ins, q | 
| 160   'data',       // in object | 164   'data',       // in object | 
| 161   'formaction', // in button, input | 165   'formaction', // in button, input | 
| 162   'href',       // in a, area, link, base, command | 166   'href',       // in a, area, link, base, command | 
| 163   'icon',       // in command | 167   'icon',       // in command | 
| 164   'manifest',   // in html | 168   'manifest',   // in html | 
| 165   'poster',     // in video | 169   'poster',     // in video | 
| 166   'src',        // in audio, embed, iframe, img, input, script, source, track, | 170   'src',        // in audio, embed, iframe, img, input, script, source, track, | 
| 167                 //    video | 171                 //    video | 
| 168 ]; | 172 ]; | 
| OLD | NEW | 
|---|