Class | HTML5::TreeBuilders::Base::Node |
In: |
lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb
|
Parent: | Object |
_flags | [RW] | A list of miscellaneous flags that can be set on the node |
childNodes | [RW] | a list of child nodes of the current node. This must include all elements but not necessarily other node types |
parent | [RW] | The parent of the current node (or nil for the document node) |
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 26 26: def initialize(name) 27: @parent = nil 28: @childNodes = [] 29: @_flags = [] 30: end
Insert node as a child of the current node
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 33 33: def appendChild(node) 34: raise NotImplementedError 35: end
Return a shallow copy of the current node i.e. a node with the same name and attributes but with no parent or child nodes
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 66 66: def cloneNode 67: raise NotImplementedError 68: end
Return true if the node has children or text, false otherwise
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 71 71: def hasContent 72: raise NotImplementedError 73: end
Insert node as a child of the current node, before refNode in the list of child nodes. Raises ValueError if refNode is not a child of the current node
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 46 46: def insertBefore(node, refNode) 47: raise NotImplementedError 48: end
Insert data as text in the current node, positioned before the start of node insertBefore or to the end of the node‘s text.
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 39 39: def insertText(data, insertBefore=nil) 40: raise NotImplementedError 41: end
Remove node from the children of the current node
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 51 51: def removeChild(node) 52: raise NotImplementedError 53: end
Move all the children of the current node to newParent. This is needed so that trees that don‘t store text as nodes move the text in the correct way
# File lib/feed_tools/vendor/html5/lib/html5/treebuilders/base.rb, line 58 58: def reparentChildren(newParent) 59: #XXX - should this method be made more general? 60: @childNodes.each { |child| newParent.appendChild(child) } 61: @childNodes = [] 62: end