Class: Browser::DOM::MutationObserver::Record
- Includes:
- NativeCachedWrapper
- 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.
Methods included from NativeCachedWrapper
#restricted?, #set_native_reference
Instance Attribute Details
#added ⇒ NodeSet (readonly)
Returns the added nodes.
46 47 48 49 50 51 52 53 54 |
# File 'opal/browser/dom/mutation_observer.rb', line 46 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.
80 |
# File 'opal/browser/dom/mutation_observer.rb', line 80 alias_native :name, :attributeName |
#namespace ⇒ String (readonly)
Returns the namespace of the attribute.
84 |
# File 'opal/browser/dom/mutation_observer.rb', line 84 alias_native :namespace, :attributeNamespace |
#old ⇒ String (readonly)
Returns the old value.
76 |
# File 'opal/browser/dom/mutation_observer.rb', line 76 alias_native :old, :oldValue |
#removed ⇒ NodeSet (readonly)
Returns the removed nodes.
58 59 60 61 62 63 64 65 66 |
# File 'opal/browser/dom/mutation_observer.rb', line 58 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.
70 71 72 |
# File 'opal/browser/dom/mutation_observer.rb', line 70 def target DOM(`#@native.target`) end |
#type ⇒ :attributes, ... (readonly)
Returns the type of the recorded change.
21 22 23 24 25 26 27 |
# File 'opal/browser/dom/mutation_observer.rb', line 21 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.
30 31 32 |
# File 'opal/browser/dom/mutation_observer.rb', line 30 def attribute? type == :attribute end |
#cdata? ⇒ Boolean
Returns true if the change happened in a CDATA section.
40 41 42 |
# File 'opal/browser/dom/mutation_observer.rb', line 40 def cdata? type == :cdata end |
#tree? ⇒ Boolean
Returns true if the change happened on the tree.
35 36 37 |
# File 'opal/browser/dom/mutation_observer.rb', line 35 def tree? type == :tree end |