W3cubDocs

/Dart 2

observe method

void observe (Node target, { bool childList, bool attributes, bool characterData, bool subtree, bool attributeOldValue, bool characterDataOldValue, List<String> attributeFilter })

Observes the target for the specified changes.

Some requirements for the optional parameters:

  • Either childList, attributes or characterData must be true.
  • If attributeOldValue is true then attributes must also be true.
  • If attributeFilter is specified then attributes must be true.
  • If characterDataOldValue is true then characterData must be true.

Implementation

void observe(Node target,
    {bool childList,
    bool attributes,
    bool characterData,
    bool subtree,
    bool attributeOldValue,
    bool characterDataOldValue,
    List<String> attributeFilter}) {
  // Parse options into map of known type.
  var parsedOptions = _createDict();

  // Override options passed in the map with named optional arguments.
  override(key, value) {
    if (value != null) _add(parsedOptions, key, value);
  }

  override('childList', childList);
  override('attributes', attributes);
  override('characterData', characterData);
  override('subtree', subtree);
  override('attributeOldValue', attributeOldValue);
  override('characterDataOldValue', characterDataOldValue);
  if (attributeFilter != null) {
    override('attributeFilter', _fixupList(attributeFilter));
  }

  _call(target, parsedOptions);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/2.0.0/dart-html/MutationObserver/observe.html