Sha256: 327c77ecc3c212b2e6eb6deaa574353e189a9319ed6a5a9f6f483a4ff1919eb4

Contents?: true

Size: 644 Bytes

Versions: 18

Compression:

Stored size: 644 Bytes

Contents

module CommentSearchers

  def find_by_comment(text, in_node=`document`)
    node = nil

    %x{
      node = document.evaluate("//comment()[. = ' " + text + " ']", in_node, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null).iterateNext();
    }
    return node
  end


  # Returns an unattached div with the nodes from the passed
  # in html.
  def build_from_html(html)
    temp_div = nil
    %x{
      temp_div = document.createElement('div');
      var doc = jQuery.parseHTML(html);

      if (doc) {
        for (var i=0;i < doc.length;i++) {
          temp_div.appendChild(doc[i]);
        }
      }
    }
    return temp_div
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
volt-0.7.20 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.19 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.18 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.17 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.16 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.15 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.14 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.13 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.12 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.10 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.9 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.8 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.7 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.6 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.5 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.4 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.3 lib/volt/page/targets/helpers/comment_searchers.rb
volt-0.7.2 lib/volt/page/targets/helpers/comment_searchers.rb