Lexing/parsing of CSS pseudos with ident arguments

This allows the lexing/parsing of expressions such as "html:lang(en)".
This commit is contained in:
Yorick Peterse committed 2014-10-15 09:42:26 +02:00
1 parent d9a4221a0a
commit 48eb4f83df
4 files changed
+30 -6

No files matched your search

+10
View File
@@ -116,5 +116,15 @@ describe Oga::CSS::Lexer do
[:T_RPAREN, nil]
]
end
example 'lex the :lang(fr) pseudo class' do
lex_css(':lang(fr)').should == [
[:T_COLON, nil],
[:T_IDENT, 'lang'],
[:T_LPAREN, nil],
[:T_IDENT, 'fr'],
[:T_RPAREN, nil]
]
end
end
end
@@ -107,5 +107,14 @@ describe Oga::CSS::Parser do
s(:pseudo, 'focus', s(:test, nil, 'x'))
)
end
example 'parse a pseudo class with an identifier as the argument' do
parse_css('x:lang(fr)').should == s(
:pseudo,
'lang',
s(:test, nil, 'x'),
s(:test, nil, 'fr')
)
end
end
end