Skip to content

Commit

Permalink
fixing broken space selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Feb 23, 2009
1 parent e4d1071 commit 5468973
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
=== HEAD

* Bugfixes

* Fixed a CSS selector space bug

=== 1.2.0 / 2008-02-22

* New features
Expand Down
4 changes: 2 additions & 2 deletions lib/nokogiri/css/tokenizer.rex
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ rule
{w}\*={w} { [:SUBSTRINGMATCH, text] }
{w}!={w} { [:NOT_EQUAL, text] }
{w}={w} { [:EQUAL, text] }
{w}\){w} { [:RPAREN, text] }
{w}\) { [:RPAREN, text] }
{w}\[{w} { [:LSQUARE, text] }
{w}\]{w} { [:RSQUARE, text] }
{w}\] { [:RSQUARE, text] }
{w}\+{w} { [:PLUS, text] }
{w}>{w} { [:GREATER, text] }
{w},{w} { [:COMMA, text] }
Expand Down
2 changes: 1 addition & 1 deletion test/css/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_attributes_with_at

def test_attributes_with_at_and_stuff
## This is non standard CSS
assert_xpath "//a[@id = 'Boing'] div",
assert_xpath "//a[@id = 'Boing']//div",
@parser.parse("a[@id='Boing'] div")
end

Expand Down
8 changes: 8 additions & 0 deletions test/html/test_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ def test_find_by_css_with_square_brackets
assert_equal 1, found.length
end

def test_find_with_function
found = @html.css("div:awesome() h1", Class.new {
def awesome divs
[divs.first]
end
}.new)
end

def test_dup_shallow
found = @html.search('//div/a').first
dup = found.dup(0)
Expand Down

0 comments on commit 5468973

Please sign in to comment.