class Motion::HTML::Element
Public Class Methods
new(element)
click to toggle source
# File lib/project/motion-html.rb, line 25 def initialize(element) @element = element end
Public Instance Methods
[](key)
click to toggle source
# File lib/project/motion-html.rb, line 41 def [](key) attributes[key] end
attributes()
click to toggle source
# File lib/project/motion-html.rb, line 37 def attributes @element.attributes end
children()
click to toggle source
# File lib/project/motion-html.rb, line 50 def children elements = [] @element.childNodes.each do |node| elements << Element.new(node) if node.is_a? HTMLElement end elements end
inspect()
click to toggle source
# File lib/project/motion-html.rb, line 64 def inspect to_html end
next_sibling()
click to toggle source
# File lib/project/motion-html.rb, line 58 def next_sibling el = @element.nextSibling el = el.nextSibling if el.is_a? HTMLText Element.new(el) if el.is_a? HTMLElement end
parent()
click to toggle source
# File lib/project/motion-html.rb, line 45 def parent el = @element.parentNode Element.new(el) if el.is_a? HTMLElement end
tag()
click to toggle source
# File lib/project/motion-html.rb, line 29 def tag @element.tagName end
text()
click to toggle source
# File lib/project/motion-html.rb, line 33 def text @element.textContent end
to_html()
click to toggle source
# File lib/project/motion-html.rb, line 68 def to_html @element.outerHTML end