Commit 9013db2b by Aaron Leung

Correctly parsing attribute selectors of the form '[attr]'.

parent 3b0663f4
...@@ -399,7 +399,8 @@ namespace Sass { ...@@ -399,7 +399,8 @@ namespace Sass {
lex< exactly<'['> >(); lex< exactly<'['> >();
if (!lex< type_selector >()) syntax_error("invalid attribute name in attribute selector"); if (!lex< type_selector >()) syntax_error("invalid attribute name in attribute selector");
Token name(lexed); Token name(lexed);
attr_sel << Node(Node::value, line_number, lexed); attr_sel << Node(Node::value, line_number, name);
if (lex< exactly<']'> >()) return attr_sel;
if (!lex< alternatives< exact_match, class_match, dash_match, if (!lex< alternatives< exact_match, class_match, dash_match,
prefix_match, suffix_match, substring_match > >()) { prefix_match, suffix_match, substring_match > >()) {
syntax_error("invalid operator in attribute selector for " + name.to_string()); syntax_error("invalid operator in attribute selector for " + name.to_string());
......
...@@ -125,7 +125,7 @@ namespace Sass { ...@@ -125,7 +125,7 @@ namespace Sass {
string result(prefix); string result(prefix);
if (!prefix.empty()) result += " "; if (!prefix.empty()) result += " ";
result += "["; result += "[";
for (int i = 0; i < 3; ++i) for (int i = 0; i < size(); ++i)
{ result += at(i).to_string(prefix); } { result += at(i).to_string(prefix); }
result += ']'; result += ']';
return result; return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment