Module: DOM::Document

Extended by:
SingleForwardable
Defined in:
opal/fron/dom/document.rb

Overview

This module is a wrapper for the native document object.

Class Method Summary collapse

Class Method Details

.active_elementDOM::Element

Returns the active element

Returns:



11
12
13
# File 'opal/fron/dom/document.rb', line 11

def self.active_element
  doc.find ':focus'
end

.bodyDOM::Element

Returns the body element

Returns:



29
30
31
# File 'opal/fron/dom/document.rb', line 29

def self.body
  @body ||= find 'body'
end

.docObject



15
16
17
# File 'opal/fron/dom/document.rb', line 15

def self.doc
  DOM::Element.new `document`
end

.headDOM::Element

Returns the head element

Returns:



22
23
24
# File 'opal/fron/dom/document.rb', line 22

def self.head
  @head ||= find 'head'
end

.titleString

Returns the documents title

Returns:



36
37
38
# File 'opal/fron/dom/document.rb', line 36

def self.title
  `document.title`
end

.title=(value) ⇒ Object

Sets the documents title with the given value

Parameters:

  • value (String)

    The title



43
44
45
# File 'opal/fron/dom/document.rb', line 43

def self.title=(value)
  `document.title = #{value}`
end