class
Myhtml::Tree
- Myhtml::Tree
- Reference
- Object
Defined in:
myhtml/tree.crInstance Method Summary
- #body
- #body!
-
#create_node(tag_id : Myhtml::Lib::MyhtmlTags)
Create a new node
- #create_node(tag_sym : Symbol)
- #create_node(tag_name : String)
-
#css(*args, **options)
Css selectors, see Node#css
-
#css(*args, **options, &)
Css selectors, see Node#css
- #document!
-
#free
Manually free object, dangerous (also called by GC finalize)
- #head
- #head!
- #html
- #html!
-
#nodes(tag_id : Myhtml::Lib::MyhtmlTags)
Top level node filter (select all nodes in tree with tag_id) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
-
#nodes(tag_sym : Symbol)
Top level node filter (select all nodes in tree with tag_sym) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
-
#nodes(tag_str : String)
Top level node filter (select all nodes in tree with tag_sym) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
- #root
- #root!
-
#to_html(*args, **options)
Convert html tree to html string, see Node#to_html
-
#to_html(*args, **options, &)
Convert html tree to html string, see Node#to_html
- #to_pretty_html(*args, **options)
- #to_pretty_html(*args, **options, &)
Instance Method Detail
Create a new node
Note: this does not add the node to any document or tree. It only
creates the object that can then be appended or inserted. See
Node#append_child
, Node#insert_after
, and Node#insert_before
tree = Myhtml::Tree.new
div = tree.create_node(:div)
a = tree.create_node(:a)
div.to_html # <div></div>
a.to_html # <a></a>
Top level node filter (select all nodes in tree with tag_id) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
myhtml.nodes(Myhtml::Lib::MyhtmlTags::MyHTML_TAG_DIV).each { |node| ... }
Top level node filter (select all nodes in tree with tag_sym) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
myhtml.nodes(:div).each { |node| ... }
Top level node filter (select all nodes in tree with tag_sym) returns Myhtml::Iterator::Collection equal with myhtml.root!.scope.nodes(...)
myhtml.nodes("div").each { |node| ... }