Class: Browser::DOM::MutationObserver::Record
- Includes:
- Native
- Defined in:
- opal/browser/dom/mutation_observer.rb
Overview
Encapsulates a recorded change.
Instance Attribute Summary collapse
-
#added ⇒ NodeSet
readonly
The added nodes.
-
#name ⇒ String
readonly
The name of the attribute.
-
#namespace ⇒ String
readonly
The namespace of the attribute.
-
#old ⇒ String
readonly
The old value.
-
#removed ⇒ NodeSet
readonly
The removed nodes.
-
#target ⇒ Node
readonly
The node the mutation affected.
-
#type ⇒ :attributes, ...
readonly
The type of the recorded change.
Instance Method Summary collapse
-
#attribute? ⇒ Boolean
Returns true if the change happened on attributes.
-
#cdata? ⇒ Boolean
Returns true if the change happened in a CDATA section.
-
#tree? ⇒ Boolean
Returns true if the change happened on the tree.
Instance Attribute Details
#added ⇒ NodeSet (readonly)
Returns the added nodes.
45 46 47 48 49 50 51 52 53 |
# File 'opal/browser/dom/mutation_observer.rb', line 45 def added array = if `#@native.addedNodes != null` Native::Array.new(`#@native.addedNodes`) else [] end NodeSet[array] end |
#name ⇒ String (readonly)
Returns the name of the attribute.
79 |
# File 'opal/browser/dom/mutation_observer.rb', line 79 alias_native :name, :attributeName |
#namespace ⇒ String (readonly)
Returns the namespace of the attribute.
83 |
# File 'opal/browser/dom/mutation_observer.rb', line 83 alias_native :namespace, :attributeNamespace |
#old ⇒ String (readonly)
Returns the old value.
75 |
# File 'opal/browser/dom/mutation_observer.rb', line 75 alias_native :old, :oldValue |
#removed ⇒ NodeSet (readonly)
Returns the removed nodes.
57 58 59 60 61 62 63 64 65 |
# File 'opal/browser/dom/mutation_observer.rb', line 57 def removed array = if `#@native.removedNodes != null` Native::Array.new(`#@native.removedNodes`) else [] end NodeSet[array] end |
#target ⇒ Node (readonly)
Returns the node the mutation affected.
69 70 71 |
# File 'opal/browser/dom/mutation_observer.rb', line 69 def target DOM(`#@native.target`) end |
#type ⇒ :attributes, ... (readonly)
Returns the type of the recorded change.
20 21 22 23 24 25 26 |
# File 'opal/browser/dom/mutation_observer.rb', line 20 def type case `#@native.type` when :attributes then :attribute when :childList then :tree when :characterData then :cdata end end |
Instance Method Details
#attribute? ⇒ Boolean
Returns true if the change happened on attributes.
29 30 31 |
# File 'opal/browser/dom/mutation_observer.rb', line 29 def attribute? type == :attribute end |
#cdata? ⇒ Boolean
Returns true if the change happened in a CDATA section.
39 40 41 |
# File 'opal/browser/dom/mutation_observer.rb', line 39 def cdata? type == :cdata end |
#tree? ⇒ Boolean
Returns true if the change happened on the tree.
34 35 36 |
# File 'opal/browser/dom/mutation_observer.rb', line 34 def tree? type == :tree end |