Sha256: c7ea1e4e21da7731afa83b195de234b8536f571e8d5e37f980a012ba8b6bc473

Contents?: true

Size: 917 Bytes

Versions: 3

Compression:

Stored size: 917 Bytes

Contents

require "webrat/core_extensions/meta_class"

module Webrat
  
  def self.nokogiri_document(stringlike) #:nodoc:
    return stringlike.dom if stringlike.respond_to?(:dom)
    
    if Nokogiri::HTML::Document === stringlike
      stringlike
    elsif Nokogiri::XML::NodeSet === stringlike
      stringlike
    elsif StringIO === stringlike
      Nokogiri::HTML(stringlike.string)
    elsif stringlike.respond_to?(:body)
      Nokogiri::HTML(stringlike.body.to_s)
    else
      Nokogiri::HTML(stringlike.to_s)
    end
  end
  
  def self.define_dom_method(object, dom) #:nodoc:
    object.meta_class.send(:define_method, :dom) do
      dom
    end
  end
  
end


module Nokogiri
  module CSS
    class XPathVisitor
      
      def visit_pseudo_class_text(node) #:nodoc:
        "@type='text'"
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
webrat-0.3.4 lib/webrat/core/nokogiri.rb
webrat-0.3.3 lib/webrat/core/nokogiri.rb
webrat-0.3.2 lib/webrat/core/nokogiri.rb