Class: WebkitRemote::Client::DomNode
- Inherits:
-
Object
- Object
- WebkitRemote::Client::DomNode
- Defined in:
- lib/webkit_remote_unstable/css.rb
Instance Method Summary collapse
-
#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
Instance Method Details
#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 |