EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

observe method

Registers a node to observe and specifies the change information to record.

IE11

 

Syntax

MutationObserver.observe(target, options);

Parameters

target [in]

Type: Node

The DOM node to observe.

options [in]

Type: MutationObserverInit

The default value of all properties is false unless otherwise specified.

ValueMeaning
childList

Set to true to monitor additions and removals of the target node's child elements. This option includes text nodes that are added or removed as children of the target element. Example:

{ childList: true }

attributes

Set to true to monitor changes (additions, removals, and changes in values) to the target node's attributes. Example:

{ attributes: true }

characterData

Set to true to monitor changes to the value of the target node's text content (child text nodes). Example:

{ characterData: true }

subtree

Set to true to also monitor changes to all of the target node's descendants (childList, attributes, or characterData must also be true). Example:

{ childList: true, subtree: true }

attributeOldValue

Set to true to record the target node's previous attribute value (attributes must also be true). Example:

{ attributes: true, attributeOldValue: true }

characterDataOldValue

Set to true to record the target node's previous text data (characterData must also be true). Example:

{ characterData: true, characterDataOldValue: true }

attributeFilter

Set to an array of attribute local names (without namespace) to only monitor changes to specific attributes (attributes must also be true). Example:

{ attributes: true, attributeFilter: ["id", "dir"] }

 

Return value

This method does not return a value.

Remarks

The attributes, childList, characterData options will by default only observe the target element in isolation, not considering any of its descendants. In order to cause the observer to watch the given element and all of its children, the subtree option must also be set to true.

See also

MutationObserver

 

 

표시:
© 2014 Microsoft