class Hyalite::DOM::Element
Public Class Methods
create(tag)
click to toggle source
# File lib/hyalite/dom/element.rb, line 93 def self.create(tag) $document.create_element(tag) end
Public Instance Methods
[](prop_name)
click to toggle source
# File lib/hyalite/dom/element.rb, line 21 def [](prop_name) `self.native[#{prop_name}]` end
add_child(child)
click to toggle source
# File lib/hyalite/dom/element.rb, line 68 def add_child(child) `self.native.appendChild(child.native)` end
add_class(name)
click to toggle source
# File lib/hyalite/dom/element.rb, line 25 def add_class(name) `self.native.classList.add(name)` self end
attributes()
click to toggle source
# File lib/hyalite/dom/element.rb, line 34 def attributes @attributes ||= Attributes.new(self) end
class_names()
click to toggle source
# File lib/hyalite/dom/element.rb, line 30 def class_names Array.new(`self.native.classList`).to_a end
document()
click to toggle source
# File lib/hyalite/dom/element.rb, line 85 def document $document end
element?()
click to toggle source
# File lib/hyalite/dom/element.rb, line 13 def element? true end
height()
click to toggle source
# File lib/hyalite/dom/element.rb, line 50 def height `#@native.clientHeight` end
inner_dom=(dom)
click to toggle source
# File lib/hyalite/dom/element.rb, line 80 def inner_dom=(dom) clear self << dom end
inner_html()
click to toggle source
# File lib/hyalite/dom/element.rb, line 72 def inner_html `self.native.innerHTML` end
inner_html=(html)
click to toggle source
# File lib/hyalite/dom/element.rb, line 76 def inner_html=(html) `self.native.innerHTML = html` end
input_type()
click to toggle source
# File lib/hyalite/dom/element.rb, line 17 def input_type `self.native.type` end
left()
click to toggle source
# File lib/hyalite/dom/element.rb, line 58 def left `#@native.clientLeft` end
style(hash)
click to toggle source
# File lib/hyalite/dom/element.rb, line 62 def style(hash) hash.each do |key, value| `self.native.style[key] = value` end end
text()
click to toggle source
# File lib/hyalite/dom/element.rb, line 38 def text `self.native.textContent` end
text=(text)
click to toggle source
# File lib/hyalite/dom/element.rb, line 42 def text=(text) `self.native.textContent = text` end
to_s()
click to toggle source
# File lib/hyalite/dom/element.rb, line 89 def to_s "<#{`self.native.tagName`} class='#{self.class_names.join(' ')}' id='#{self['id']}'/>" end
top()
click to toggle source
# File lib/hyalite/dom/element.rb, line 54 def top `#@native.clientTop` end
width()
click to toggle source
# File lib/hyalite/dom/element.rb, line 46 def width `#@native.clientWidth` end