Class HTML5::TreeBuilders::Hpricot::Element
In: lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb
Parent: Node

Methods

Classes and Modules

Class HTML5::TreeBuilders::Hpricot::Element::AttributeProxy

Public Class methods

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 67
67:         def self.hpricot_class
68:           ::Hpricot::Elem
69:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 71
71:         def initialize(name)
72:           super(name)
73: 
74:           @hpricot = ::Hpricot::Elem.new(::Hpricot::STag.new(name))
75:         end

Public Instance methods

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 113
113:         def attributes
114:           AttributeProxy.new(@hpricot)
115:         end

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 117
117:         def attributes=(attrs)
118:           attrs.each { |name, value| @hpricot[name] = value }
119:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 81
81:         def cloneNode
82:           attributes.inject(self.class.new(name)) do |node, (name, value)|
83:             node.hpricot[name] = value
84:             node
85:           end
86:         end

[Source]

    # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 77
77:         def name
78:           @hpricot.stag.name
79:         end

[Source]

     # File lib/feed_tools/vendor/html5/lib/html5/treebuilders/hpricot.rb, line 121
121:         def printTree(indent=0)
122:           tree = "\n|#{' ' * indent}<#{name}>"
123:           indent += 2
124:           attributes.each do |name, value|
125:             next if name == 'xmlns'
126:             tree += "\n|#{' ' * indent}#{name}=\"#{value}\""
127:           end
128:           childNodes.inject(tree) { |tree, child| tree + child.printTree(indent) }
129:         end

[Validate]