class Hyalite::DOM::Collection

Public Instance Methods

[](index) click to toggle source
# File lib/hyalite/dom/collection.rb, line 16
def [](index)
  Element.new(`self.native.item(index)`)
end
each(&block) click to toggle source
# File lib/hyalite/dom/collection.rb, line 8
def each(&block)
  `self.native.length`.times do |i|
    block.call Element.new(`self.native.item(i)`)
  end

  nil
end
first() click to toggle source
# File lib/hyalite/dom/collection.rb, line 20
def first
  Element.new(`self.native.item(0)`)
end
last() click to toggle source
# File lib/hyalite/dom/collection.rb, line 24
def last
  Element.new(`self.native.item(self.native.length - 1)`)
end
length() click to toggle source
# File lib/hyalite/dom/collection.rb, line 28
def length
  `self.native.length`
end