Sha256: c79872faaeb57a26d046823df7afdd368266031bffbcb6a6e0b04e8fe2eae9a3

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

module Watir

  class Element

    attr_reader :doc

    #
    # Store instance of Nokogiri
    #

    def doc=(html)
      @doc = html
      return if html.nil?

      @reset_doc_hook = ->(element) { element.reset_doc }
      browser.after_hooks.add(@reset_doc_hook)
    end

    def reset_doc
      @doc = nil
      browser.after_hooks.delete(@reset_doc_hook)
    end

    #
    # TODO - reimplement with Watir Executor when available
    #
    # Uses Nokogiri to return the text of the element.
    #
    # @return [String]
    #

    def text!
      @selector[:nokogiri] = true
      text
    end

    alias_method :el_stale?, :stale?
    def stale?
      @doc.nil? && el_stale?
    end

  end # Element
end # Watir

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watigiri-0.3.0 lib/extensions/watir/element.rb