Module: WebkitRemote::Client::Dom
- Included in:
- WebkitRemote::Client
- Defined in:
- lib/webkit_remote/client/dom.rb
Overview
API for the DOM domain.
Instance Method Summary collapse
-
#clear_dom ⇒ WebkitRemote::Client
Removes all the cached DOM information.
-
#dom_node(remote_id) ⇒ WebkitRemote::Client::DomNode
Looks up cached information about a DOM node.
-
#dom_root ⇒ WebkitRemote::Client::DomNode
The root DOM node.
-
#dom_root! ⇒ WebkitRemote::Client::DomNode
Obtains the root DOM node, bypassing the cache.
-
#dom_update_node(raw_node) ⇒ WebkitRemote::Client::DomNode
Updates cached information about a DOM node.
- #initialize_dom ⇒ Object
Instance Method Details
#clear_dom ⇒ WebkitRemote::Client
Removes all the cached DOM information.
23 24 25 26 27 |
# File 'lib/webkit_remote/client/dom.rb', line 23 def clear_dom @dom_root = nil @dom_nodes.clear self end |
#dom_node(remote_id) ⇒ WebkitRemote::Client::DomNode
Looks up cached information about a DOM node.
38 39 40 |
# File 'lib/webkit_remote/client/dom.rb', line 38 def dom_node(remote_id) @dom_nodes[remote_id] ||= WebkitRemote::Client::DomNode.new remote_id, self end |
#dom_root ⇒ WebkitRemote::Client::DomNode
Returns the root DOM node.
8 9 10 |
# File 'lib/webkit_remote/client/dom.rb', line 8 def dom_root @dom_root ||= dom_root! end |
#dom_root! ⇒ WebkitRemote::Client::DomNode
Obtains the root DOM node, bypassing the cache.
15 16 17 18 |
# File 'lib/webkit_remote/client/dom.rb', line 15 def dom_root! result = @rpc.call 'DOM.getDocument' @dom_root = dom_update_node result['root'] end |
#dom_update_node(raw_node) ⇒ WebkitRemote::Client::DomNode
Updates cached information about a DOM node.
53 54 55 56 |
# File 'lib/webkit_remote/client/dom.rb', line 53 def dom_update_node(raw_node) remote_id = raw_node['nodeId'] dom_node(remote_id).update_all raw_node end |
#initialize_dom ⇒ Object
43 44 45 |
# File 'lib/webkit_remote/client/dom.rb', line 43 def initialize_dom @dom_nodes = {} end |