Class: Dommy::MutationRecord
- Inherits:
-
Object
- Object
- Dommy::MutationRecord
- Defined in:
- lib/dommy/observer.rb
Overview
MutationRecord — produced for childList, attributes, or characterData mutations and delivered to the observer callback. Mirrors the browser MutationRecord interface; ‘oldValue` is only populated when the observer asked for it via `attributeOldValue` / `characterDataOldValue`.
Instance Attribute Summary collapse
-
#added_nodes ⇒ Object
readonly
Returns the value of attribute added_nodes.
-
#attribute_name ⇒ Object
readonly
Returns the value of attribute attribute_name.
-
#attribute_namespace ⇒ Object
readonly
Returns the value of attribute attribute_namespace.
-
#next_sibling ⇒ Object
readonly
Returns the value of attribute next_sibling.
-
#old_value ⇒ Object
readonly
Returns the value of attribute old_value.
-
#previous_sibling ⇒ Object
readonly
Returns the value of attribute previous_sibling.
-
#removed_nodes ⇒ Object
readonly
Returns the value of attribute removed_nodes.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type:, target:, added_nodes: [], removed_nodes: [], previous_sibling: nil, next_sibling: nil, attribute_name: nil, attribute_namespace: nil, old_value: nil) ⇒ MutationRecord
constructor
A new instance of MutationRecord.
Constructor Details
#initialize(type:, target:, added_nodes: [], removed_nodes: [], previous_sibling: nil, next_sibling: nil, attribute_name: nil, attribute_namespace: nil, old_value: nil) ⇒ MutationRecord
Returns a new instance of MutationRecord.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dommy/observer.rb', line 12 def initialize( type:, target:, added_nodes: [], removed_nodes: [], previous_sibling: nil, next_sibling: nil, attribute_name: nil, attribute_namespace: nil, old_value: nil ) @type = type @target = target @added_nodes = added_nodes @removed_nodes = removed_nodes @previous_sibling = previous_sibling @next_sibling = next_sibling @attribute_name = attribute_name @attribute_namespace = attribute_namespace @old_value = old_value end |
Instance Attribute Details
#added_nodes ⇒ Object (readonly)
Returns the value of attribute added_nodes.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def added_nodes @added_nodes end |
#attribute_name ⇒ Object (readonly)
Returns the value of attribute attribute_name.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def attribute_name @attribute_name end |
#attribute_namespace ⇒ Object (readonly)
Returns the value of attribute attribute_namespace.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def attribute_namespace @attribute_namespace end |
#next_sibling ⇒ Object (readonly)
Returns the value of attribute next_sibling.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def next_sibling @next_sibling end |
#old_value ⇒ Object (readonly)
Returns the value of attribute old_value.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def old_value @old_value end |
#previous_sibling ⇒ Object (readonly)
Returns the value of attribute previous_sibling.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def previous_sibling @previous_sibling end |
#removed_nodes ⇒ Object (readonly)
Returns the value of attribute removed_nodes.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def removed_nodes @removed_nodes end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def target @target end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
34 35 36 |
# File 'lib/dommy/observer.rb', line 34 def type @type end |
Instance Method Details
#__js_get__(key) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/dommy/observer.rb', line 46 def __js_get__(key) case key when "type" @type when "target" @target when "addedNodes" @added_nodes when "removedNodes" @removed_nodes when "previousSibling" @previous_sibling when "nextSibling" @next_sibling when "attributeName" @attribute_name when "attributeNamespace" @attribute_namespace when "oldValue" @old_value end end |