Chromium Code Reviews| Index: lib/src/analyzer.dart |
| diff --git a/lib/src/analyzer.dart b/lib/src/analyzer.dart |
| index 19ffc292325230173b7aa37592be0ce21c388b41..e29f08897c6e70feda82819e08b5217c3340a2ec 100644 |
| --- a/lib/src/analyzer.dart |
| +++ b/lib/src/analyzer.dart |
| @@ -8,6 +8,7 @@ |
| */ |
| library analyzer; |
| +import 'dart:uri'; |
| import 'package:html5lib/dom.dart'; |
| import 'package:html5lib/dom_parsing.dart'; |
| import 'package:source_maps/span.dart'; |
| @@ -119,18 +120,6 @@ class _Analyzer extends TreeVisitor { |
| info = new ElementInfo(node, parent); |
| } |
| - // TODO(terry): How to handle <link rel="stylesheet" href="..."> |
| - // - What if multiple stylesheet links for a component? |
| - // - What if a stylesheet link for all component and particular |
| - // stylesheet links for each component? |
| - // - What if multiple <style> tags for the same component? |
| - if (node.tagName == 'style' && node.attributes.containsKey("scoped")) { |
| - // TODO(terry): Faster to parse the CSS tags separately instead of |
| - // concatenating all styles. |
| - // Get contents of style tag. |
| - _currentInfo.cssSource.write(node.nodes.single.value); |
| - } |
| - |
| visitElementInfo(info); |
| if (_parent == null) { |
| @@ -738,7 +727,7 @@ class _ElementLoader extends TreeVisitor { |
| void visitLinkElement(Element node) { |
| // TODO(jmesserly): deprecate the plural form, it is singular in the spec. |
| var rel = node.attributes['rel']; |
| - if (rel != 'component' && rel != 'components') return; |
| + if (rel != 'components' && rel != 'stylesheet') return; |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
there seems to be a bad merge here. this should al
terry
2013/03/08 20:11:24
Nice catch yeah it was a bad merge.
On 2013/03/07
|
| if (!_inHead) { |
| _messages.warning('link rel="$rel" only valid in ' |
| @@ -760,7 +749,18 @@ class _ElementLoader extends TreeVisitor { |
| path = _fileInfo.path.directoryPath.join(new Path(href)); |
| } |
| - _fileInfo.componentLinks.add(path); |
| + switch (rel) { |
| + case 'components': |
|
Siggi Cherem (dart-lang)
2013/03/07 22:14:20
given that there are only two options (since you r
terry
2013/03/08 20:11:24
Done.
|
| + _fileInfo.componentLinks.add(path); |
| + break; |
| + case 'stylesheet': |
| + // Local stylesheets only are handled. |
| + var scheme = Uri.parse(href).scheme; |
| + if (scheme != 'http' && scheme != 'https') { |
| + _fileInfo.styleSheetHref.add(path); |
| + } |
| + break; |
| + } |
| } |
| void visitElementElement(Element node) { |