Permalink
Browse files

Implemented Expression Fallback Selectors

  • Loading branch information...
1 parent b2af308 commit 8fb886b2e1c740cb572c49be81163cb2f5627f78 @bmavity committed Sep 23, 2010
Showing with 6 additions and 5 deletions.
  1. +5 −3 src/cssSelector.ometa
  2. +1 −2 tests/test.js
View
@@ -61,7 +61,7 @@ ometa CssSelector <: Parser {
NOT = ':' N O T '(' -> { ':not(' },
ATKEYWORD = '@' ident,
INVALID = invalid,
- PERCENTAGE = num '%',
+ PERCENTAGE = num:n '%' -> { n + '%' },
DIMENSION = num:n ident:i -> { n + i },
CDO = '<' '!' '-' '-',
CDC = '-' '-' '>',
@@ -86,7 +86,9 @@ ometa CssSelector <: Parser {
| namespace_prefix:pre element_name:ele non_namespaced_selector*:post -> { pre + ele + post.join('') }
| '*' non_namespaced_selector*:post -> { '*' + post.join('') }
| element_name:ele non_namespaced_selector*:post -> { ele + post.join('') }
- | non_namespaced_selector+:sels -> { sels.join('') },
+ | non_namespaced_selector+:sels -> { sels.join('') }
+ // Css Hack
+ | expression:ex -> { ex },
namespace_prefix = ('*' | IDENT):pre '|' -> { pre + '|' }
| '|' -> { '|' },
// First line of the next selector is a Css Hack
@@ -105,7 +107,7 @@ ometa CssSelector <: Parser {
| ':' (functional_pseudo | IDENT):i -> { ':' + i },
functional_pseudo = FUNCTION:f S* full_expression:e ')' -> { f + e + ')' },
- expression_content = (PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT):e -> { e },
+ expression_content = (PLUS | '-' | PERCENTAGE | DIMENSION | NUMBER | STRING | IDENT):e -> { e },
expression = expression_content:ec S+ expression:e -> { ec + ' ' + e }
| expression_content:ec expression:e -> { ec + e }
| expression_content:ec S* -> { ec },
View
@@ -225,7 +225,7 @@ vows.describe('Selectors with Newlines').addBatch({
"E\nF": shouldParse(),
"E, F\nG, H": shouldParse()
}).run();
-
+*/
vows.describe('Expression Fallback Selectors').addBatch({
'0%': shouldParse(),
@@ -234,7 +234,6 @@ vows.describe('Expression Fallback Selectors').addBatch({
'12px': shouldParse(),
'"foo"': shouldParse()
}).run();
-*/
vows.describe('Functional Pseudo Selectors').addBatch({

0 comments on commit 8fb886b

Please sign in to comment.