Class: Browser::DOM::MutationObserver::Record

Inherits:
Object
  • Object
show all
Includes:
NativeCachedWrapper
Defined in:
opal/browser/dom/mutation_observer.rb

Overview

Encapsulates a recorded change.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NativeCachedWrapper

#restricted?, #set_native_reference

Instance Attribute Details

#addedNodeSet (readonly)



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

#nameString (readonly)



79
# File 'opal/browser/dom/mutation_observer.rb', line 79

alias_native :name, :attributeName

#namespaceString (readonly)



83
# File 'opal/browser/dom/mutation_observer.rb', line 83

alias_native :namespace, :attributeNamespace

#oldString (readonly)



75
# File 'opal/browser/dom/mutation_observer.rb', line 75

alias_native :old, :oldValue

#removedNodeSet (readonly)



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

#targetNode (readonly)



69
70
71
# File 'opal/browser/dom/mutation_observer.rb', line 69

def target
  DOM(`#@native.target`)
end

#type:attributes, ... (readonly)



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