Chromium Code Reviews| Index: lib/src/analyzer.dart |
| diff --git a/lib/src/analyzer.dart b/lib/src/analyzer.dart |
| index 6f6dd5c34c97bd6733b8f16122bc58774cd04550..6b9bd1bb1814caa4062f2a81abe9e8351c42b7bf 100644 |
| --- a/lib/src/analyzer.dart |
| +++ b/lib/src/analyzer.dart |
| @@ -77,6 +77,7 @@ class _Analyzer extends TreeVisitor { |
| Iterator<int> _uniqueIds; |
| Map<String, String> _pseudoElements; |
| Messages _messages; |
| + bool _inHead = false; |
| /** |
| * Whether to keep indentation spaces. Break lines and indentation spaces |
| @@ -181,12 +182,18 @@ class _Analyzer extends TreeVisitor { |
| _keepIndentationSpaces = value != 'remove'; |
| } |
| + var savedInHead = _inHead; |
| + if (node.tagName == 'head') { |
|
Jennifer Messerly
2013/07/23 20:39:04
alternatively, we could just skip visiting "head"?
Siggi Cherem (dart-lang)
2013/07/23 21:03:04
We could skip head, but in that case we would not
Jennifer Messerly
2013/07/23 21:04:03
yeah, okay to me either way. just worried what els
Siggi Cherem (dart-lang)
2013/07/23 21:07:04
funny - I worry about the opposite =)... I mean, w
|
| + _inHead = true; |
| + } |
| + |
| // Invoke super to visit children. |
| super.visitElement(node); |
| _keepIndentationSpaces = keepSpaces; |
| _currentInfo = lastInfo; |
| _parent = savedParent; |
| + _inHead = savedInHead; |
| if (_needsIdentifier(info)) { |
| _ensureParentHasVariable(info); |
| @@ -434,6 +441,10 @@ class _Analyzer extends TreeVisitor { |
| if (attrInfo != null) { |
| info.attributes[name] = attrInfo; |
| + if (_inHead) { |
| + _messages.error('Attribute bindings are not supported under the <head>' |
|
Jennifer Messerly
2013/07/23 20:39:04
I forgot, does an error cause us to skip running e
Siggi Cherem (dart-lang)
2013/07/23 21:03:04
correct
|
| + 'element', info.node.attributeSpans[name]); |
| + } |
| } |
| // Any component's custom pseudo-element(s) defined? |
| @@ -693,6 +704,10 @@ class _Analyzer extends TreeVisitor { |
| } |
| _parent.childrenCreatedInCode = true; |
| + if (_inHead) { |
| + _messages.error('Bindings are not supported under the <head> element', |
| + text.sourceSpan); |
| + } |
| // We split [text] so that each binding has its own text node. |
| var node = text.parent; |