Skip to content

Commit

Permalink
adding a deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Feb 23, 2009
1 parent 1c7ee37 commit 13db61b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 5 additions & 0 deletions lib/nokogiri/css/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def without_cache &block
###
# Parse this CSS selector in +selector+. Returns an AST.
def parse selector
@warned ||= false
unless @warned
$stderr.puts('Nokogiri::CSS::Parser.parse is deprecated, call Nokogiri::CSS.parse()')
@warned = true
end
new.parse selector
end
end
Expand Down
6 changes: 0 additions & 6 deletions test/css/test_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ def test_syntax_error_raised
assert_raises(CSS::SyntaxError) { @parser.parse("a[x=]") }
end

# Used in webrat
def test_parser_class_can_parse_css
assert_xpath "//a[starts-with(@id, 'Boing')]",
Parser.parse("a[id^='Boing']")
end

def test_find_by_type
ast = @parser.parse("a:nth-child(2)").first
matches = ast.find_by_type(
Expand Down

0 comments on commit 13db61b

Please sign in to comment.