Skip to content

Commit

Permalink
Moving over Nokogiri extensions and vendoring nokogiri CSS support fo…
Browse files Browse the repository at this point in the history
…r people without nokogiri installed
  • Loading branch information
brynary committed Nov 6, 2008
1 parent 11f291c commit a8e0e75
Show file tree
Hide file tree
Showing 12 changed files with 1,458 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/webrat/core/matchers.rb
Expand Up @@ -6,9 +6,10 @@ def initialize(expected, &block)
# Require nokogiri and fall back on rexml
begin
require "nokogiri"
require "webrat/nokogiri"
rescue LoadError => e
if require "rexml/document"
require "merb-core/vendor/nokogiri/css"
require "webrat/vendor/nokogiri/css"
warn("Standard REXML library is slow. Please consider installing nokogiri.\nUse \"sudo gem install nokogiri\"")
end
end
Expand Down
15 changes: 15 additions & 0 deletions lib/webrat/nokogiri.rb
@@ -0,0 +1,15 @@
module Nokogiri
module CSS
class XPathVisitor

def visit_pseudo_class_text(node)
"@type='text'"
end

def visit_pseudo_class_password(node)
"@type='password'"
end

end
end
end
6 changes: 6 additions & 0 deletions lib/webrat/vendor/nokogiri/css.rb
@@ -0,0 +1,6 @@
require 'merb-core/vendor/nokogiri/css/node'
require 'merb-core/vendor/nokogiri/css/xpath_visitor'
require 'merb-core/vendor/nokogiri/css/generated_tokenizer'
require 'merb-core/vendor/nokogiri/css/generated_parser'
require 'merb-core/vendor/nokogiri/css/tokenizer'
require 'merb-core/vendor/nokogiri/css/parser'

0 comments on commit a8e0e75

Please sign in to comment.