Module: Taka::DOM::HTML::Document

Defined in:
lib/taka/dom/html/document.rb

Instance Method Summary collapse

Instance Method Details

#anchorsObject



46
47
48
# File 'lib/taka/dom/html/document.rb', line 46

def anchors
  xpath('.//a[@name]')
end

#appletsObject



30
31
32
# File 'lib/taka/dom/html/document.rb', line 30

def applets
  xpath('.//object[applet]', './/applet')
end

#bodyObject



22
23
24
# File 'lib/taka/dom/html/document.rb', line 22

def body
  at('.//body')
end

#closeObject



75
76
77
78
79
80
81
82
# File 'lib/taka/dom/html/document.rb', line 75

def close
  @tmp_doc ||= nil
  return unless @tmp_doc
  Nokogiri::HTML.fragment(@tmp_doc || '').each { |node|
    document.add_child node
  }
  @tmp_doc = nil
end

The cookies associated with this document. If there are none, the value is an empty string. Otherwise, the value is a string: a semicolon-delimited list of “name, value” pairs for all the cookies associated with the page. For example, name=value;expires=date.



54
55
56
# File 'lib/taka/dom/html/document.rb', line 54

def cookie
  ''
end

#domainObject

The domain name of the server that served the document, or a null string if the server cannot be identified by a domain name.



18
19
20
# File 'lib/taka/dom/html/document.rb', line 18

def domain
  ''
end

#formsObject



42
43
44
# File 'lib/taka/dom/html/document.rb', line 42

def forms
  xpath('.//form')
end

#getElementsByName(name) ⇒ Object



58
59
60
# File 'lib/taka/dom/html/document.rb', line 58

def getElementsByName name
  xpath(".//*[@name='#{name}']")
end

#imagesObject



26
27
28
# File 'lib/taka/dom/html/document.rb', line 26

def images
  xpath('.//img')
end


38
39
40
# File 'lib/taka/dom/html/document.rb', line 38

def links
  xpath('.//area[@href]', './/a[@href]')
end

#openObject



62
63
64
# File 'lib/taka/dom/html/document.rb', line 62

def open
  children.each { |child| child.unlink }
end

#referrerObject

Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).



12
13
14
# File 'lib/taka/dom/html/document.rb', line 12

def referrer
  ''
end

#titleObject



5
6
7
# File 'lib/taka/dom/html/document.rb', line 5

def title
  at('.//title').text
end

#URLObject



34
35
36
# File 'lib/taka/dom/html/document.rb', line 34

def URL
  url
end

#write(string) ⇒ Object



66
67
68
69
# File 'lib/taka/dom/html/document.rb', line 66

def write string
  @tmp_doc ||= ''
  @tmp_doc << string
end

#writeln(string) ⇒ Object



71
72
73
# File 'lib/taka/dom/html/document.rb', line 71

def writeln string
  write("#{string}\n")
end