Class: HTML5::TreeBuilders::SimpleTree::Element

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

Direct Known Subclasses

DocumentFragment

Instance Attribute Summary

Attributes inherited from Node

#attributes, #name, #value

Attributes inherited from Base::Node

#_flags, #childNodes, #parent

Instance Method Summary collapse

Methods inherited from Node

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

Methods inherited from Base::Node

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

Constructor Details

This class inherits a constructor from HTML5::TreeBuilders::SimpleTree::Node

Instance Method Details

#printTree(indent = 0) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/html5/treebuilders/simpletree.rb', line 83

def printTree indent=0
  tree = "\n|%s%s" % [' '* indent, self.to_s]
  indent += 2
  for name, value in attributes
    tree += "\n|%s%s=\"%s\"" % [' ' * indent, name, value]
  end
  for child in childNodes
    tree += child.printTree(indent)
  end
  tree
end

#to_sObject



79
80
81
# File 'lib/html5/treebuilders/simpletree.rb', line 79

def to_s
   "<#{name}>"
end