Sha256: 3b932ca42ada0c239acead5981e72578974d2c56974201942c92f3d5000caa36

Contents?: true

Size: 999 Bytes

Versions: 1

Compression:

Stored size: 999 Bytes

Contents

require "webrat/core_extensions/meta_class"

module Webrat #:nodoc:
  module XML #:nodoc:

    def self.document(stringlike) #:nodoc:
      return stringlike.dom if stringlike.respond_to?(:dom)

      case stringlike
      when Nokogiri::HTML::Document
      when Nokogiri::XML::NodeSet
        stringlike
      else
        stringlike = stringlike.body if stringlike.respond_to?(:body)
        stringlike = stringlike.to_s

        if stringlike =~ /\<\?xml/
          Nokogiri::XML(stringlike)
        else
          Nokogiri::HTML(stringlike)
        end
      end
    end

    def self.define_dom_method(object, dom) #:nodoc:
      object.meta_class.send(:define_method, :dom) do
        dom
      end
    end

  end
end

module Nokogiri #:nodoc:
  module CSS #:nodoc:
    class XPathVisitor #:nodoc:

      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

1 entries across 1 versions & 1 rubygems

Version Path
indirect-webrat-0.7.5 lib/webrat/core/xml.rb