Class HTML5::TreeBuilders::Hpricot::Node
In: lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb
Parent: Base::Node
Phase XmlElementPhase InTablePhase RootElementPhase InHeadPhase AfterHeadPhase AfterFramesetPhase XmlRootPhase InTableBodyPhase InFramesetPhase InColumnGroupPhase InitialPhase InCaptionPhase TrailingEndPhase InSelectPhase BeforeHeadPhase AfterBodyPhase InCellPhase InBodyPhase InRowPhase XhmlRootPhase Exception SerializeError EOF AssertionError ParseError HTMLSanitizer HTMLTokenizer XMLParser XHTMLParser HTMLParser String EncodingBytes HTMLSerializer XHTMLSerializer TreeWalkers::Base NonRecursiveTreeWalker TreeWalker TreeWalker Base TreeWalker Element DocumentFragment Node CommentNode DocumentType TextNode Document Base::Node Node Node Base::TreeBuilder TreeBuilder TreeBuilder TreeBuilder Element DocumentFragment CommentNode DocumentType TextNode Document Element DocumentFragment CommentNode DocumentType TextNode Document Base InjectMetaCharset OptionalTagFilter WhitespaceFilter HTMLSanitizeFilter HTMLSanitizeModule Enumerable TestData SimpleDelegator HTMLInputStream EncodingParser ContentAttrParser Node TreeBuilder lib/feed_tools/vendor/html5/lib/html5/html5parser/trailing_end_phase.rb lib/feed_tools/vendor/html5/lib/html5/constants.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_frameset_phase.rb lib/feed_tools/vendor/html5/lib/html5/liberalxmlparser.rb lib/feed_tools/vendor/html5/lib/html5/serializer/xhtmlserializer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_caption_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/initial_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_frameset_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/serializer/htmlserializer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/root_element_phase.rb lib/feed_tools/vendor/html5/lib/html5/tokenizer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/before_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_select_phase.rb lib/feed_tools/vendor/html5/lib/html5/inputstream.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_table_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_row_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_cell_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_body_phase.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/after_head_phase.rb lib/feed_tools/vendor/html5/lib/html5/sanitizer.rb lib/feed_tools/vendor/html5/lib/html5/html5parser/in_column_group_phase.rb lib/feed_tools/vendor/html5/lib/html5/treewalkers/base.rb lib/feed_tools/vendor/html5/lib/html5/treewalkers/hpricot.rb Hpricot TokenConstructor lib/feed_tools/vendor/html5/lib/html5/treewalkers/rexml.rb REXML lib/feed_tools/vendor/html5/lib/html5/treewalkers/simpletree.rb SimpleTree TreeWalkers HTMLSanitizeModule lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb Hpricot lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb Base lib/feed_tools/vendor/html5/lib/html5/treebuilders/rexml.rb REXML lib/feed_tools/vendor/html5/lib/html5/treebuilders/simpletree.rb SimpleTree TreeBuilders lib/feed_tools/vendor/html5/lib/html5/filters/whitespace.rb lib/feed_tools/vendor/html5/lib/html5/filters/optionaltags.rb lib/feed_tools/vendor/html5/lib/html5/filters/base.rb lib/feed_tools/vendor/html5/lib/html5/filters/inject_meta_charset.rb lib/feed_tools/vendor/html5/lib/html5/filters/sanitizer.rb Filters Sniffer lib/feed_tools/vendor/html5/tests/preamble.rb TestSupport HTML5 dot/m_75_0.png

Methods

Attributes

hpricot  [RW] 

Public Class methods

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 16
16:         def initialize(name)
17:           super(name)
18:           @hpricot = self.class.hpricot_class.new name
19:         end

Public Instance methods

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 21
21:         def appendChild(node)
22:           if node.kind_of?(TextNode) and childNodes.any? and childNodes.last.kind_of?(TextNode)
23:             childNodes.last.hpricot.content = childNodes.last.hpricot.content + node.hpricot.content
24:           else
25:             childNodes << node
26:             hpricot.children << node.hpricot
27:           end
28:           if (oldparent = node.hpricot.parent) != nil
29:             oldparent.children.delete_at(oldparent.children.index(node.hpricot))
30:           end
31:           node.hpricot.parent = hpricot
32:           node.parent = self
33:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 60
60:         def hasContent
61:           childNodes.any?
62:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 50
50:         def insertBefore(node, refNode)
51:           index = childNodes.index(refNode)
52:           if node.kind_of?(TextNode) and index > 0 and childNodes[index-1].kind_of?(TextNode)
53:             childNodes[index-1].hpricot.content = childNodes[index-1].hpricot.to_s + node.hpricot.to_s
54:           else
55:             refNode.hpricot.parent.insert_before(node.hpricot,refNode.hpricot)
56:             childNodes.insert(index, node)
57:           end
58:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 42
42:         def insertText(data, before=nil)
43:           if before
44:             insertBefore(TextNode.new(data), before)
45:           else
46:             appendChild(TextNode.new(data))
47:           end
48:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 35
35:         def removeChild(node)
36:            childNodes.delete(node)
37:            hpricot.children.delete_at(hpricot.children.index(node.hpricot))
38:            node.hpricot.parent = nil
39:            node.parent = nil
40:         end

[Validate]