Class: WebkitRemote::Client::DomNode
- Inherits:
-
Object
- Object
- WebkitRemote::Client::DomNode
- Defined in:
- lib/webkit_remote_unstable/dom.rb,
lib/webkit_remote_unstable/css.rb
Overview
Unstable cached information about a DOM node.
Instance Method Summary collapse
-
#box_model ⇒ WebkitRemote::Client::BoxModel
This node’s box model information.
-
#box_model! ⇒ WebkitRemote::Client::BoxModel
Retrieves this node’s box model, bypassing the cache.
-
#computed_style ⇒ Hash<Symbol, String>
Computed CSS attributes for this node.
-
#computed_style! ⇒ Hash<Symbol, String>
Gets the node’s computed CSS attributes, bypassing the node cache.
- #initialize_css ⇒ Object
- #initialize_unstable ⇒ Object
Instance Method Details
#box_model ⇒ WebkitRemote::Client::BoxModel
This node’s box model information.
28 29 30 |
# File 'lib/webkit_remote_unstable/dom.rb', line 28 def box_model @box_model ||= box_model! end |
#box_model! ⇒ WebkitRemote::Client::BoxModel
Retrieves this node’s box model, bypassing the cache.
35 36 37 38 |
# File 'lib/webkit_remote_unstable/dom.rb', line 35 def box_model! result = @client.rpc.call 'DOM.getBoxModel', nodeId: @remote_id WebkitRemote::Client::DomBoxModel.new result['model'] end |
#computed_style ⇒ Hash<Symbol, String>
Returns computed CSS attributes for this node.
42 43 44 |
# File 'lib/webkit_remote_unstable/css.rb', line 42 def computed_style @computed_style ||= computed_style! end |
#computed_style! ⇒ Hash<Symbol, String>
Gets the node’s computed CSS attributes, bypassing the node cache.
49 50 51 52 53 54 |
# File 'lib/webkit_remote_unstable/css.rb', line 49 def computed_style! result = @client.rpc.call 'CSS.getComputedStyleForNode', nodeId: @remote_id @computed_style = Hash[result['computedStyle'].map { |property| [property['name'].gsub('-', '_').to_sym, property['value']] }] end |
#initialize_css ⇒ Object
57 58 59 |
# File 'lib/webkit_remote_unstable/css.rb', line 57 def initialize_css @computed_style = nil end |
#initialize_unstable ⇒ Object
41 42 43 |
# File 'lib/webkit_remote_unstable/dom.rb', line 41 def initialize_unstable @box_model = nil end |