class Hyalite::DOM::Document

Public Class Methods

singleton() click to toggle source
# File lib/hyalite/dom/document.rb, line 22
def self.singleton
  @singleton ||= self.new(`window.document`)
end

Public Instance Methods

[](q) click to toggle source
# File lib/hyalite/dom/document.rb, line 30
def [](q)
  Collection.new `self.native.querySelectorAll(#{q})`
end
body() click to toggle source
# File lib/hyalite/dom/document.rb, line 14
def body
  Body.new `self.native.body`
end
create_element(tag) click to toggle source
# File lib/hyalite/dom/document.rb, line 6
def create_element(tag)
  Element.new `self.native.createElement(tag)`
end
create_text(text) click to toggle source
# File lib/hyalite/dom/document.rb, line 10
def create_text(text)
  Text.new `self.native.createTextNode(text)`
end
document?() click to toggle source
# File lib/hyalite/dom/document.rb, line 26
def document?
  true
end
ready(&block) click to toggle source
# File lib/hyalite/dom/document.rb, line 18
def ready(&block)
  `self.native.addEventListener('DOMContentLoaded', block)`
end