Class: HTML5::TreeBuilders::REXML::Document

Inherits:
Node show all
Defined in:
lib/html5/treebuilders/rexml.rb

Instance Attribute Summary

Attributes inherited from Node

#rxobj

Attributes inherited from Base::Node

#_flags, #childNodes, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#appendChild, #hasContent, #insertBefore, #insertText, #removeChild

Methods inherited from Base::Node

#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren

Constructor Details

#initializeDocument

Returns a new instance of Document.



98
99
100
# File 'lib/html5/treebuilders/rexml.rb', line 98

def initialize
  super nil
end

Class Method Details

.rxclassObject



94
95
96
# File 'lib/html5/treebuilders/rexml.rb', line 94

def self.rxclass
  ::REXML::Document
end

Instance Method Details

#printTree(indent = 0) ⇒ Object

ryansking: not sure why this was here. removing it doesn’t cause any tests to fail def appendChild node

if node.kind_of? Element and node.name == 'html'
  node.rxobj.add_namespace('http://www.w3.org/1999/xhtml')
end
super node

end



110
111
112
113
114
115
116
# File 'lib/html5/treebuilders/rexml.rb', line 110

def printTree indent=0
  tree = "#document"
  for child in childNodes
    tree += child.printTree(indent + 2)
  end
  return tree
end