UserDataHandler

  • Revision slug: DOM/UserDataHandler
  • Revision title: UserDataHandler
  • Revision id: 60018
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment 10 words added

Revision Content

{{ DomRef() }}

Summary

When associating user data with a key on a node, Node.setUserData() can also accept, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted. Per the specification, exceptions should not be thrown in a UserDataHandler. In both document.importNode() and Node.cloneNode(), although user data is not copied over, the handler will be called.

Properties

None

Methods

handle ( operationInt, keyString, DOMUserData, srcNode, dstNode ) (no return)

Constants

NODE_RENAMED is currently not supported since Node.renameNode() is not supported.

Constant Value
NODE_CLONED 1
NODE_IMPORTED 2
NODE_DELETED {{ unimplemented_inline("550400") }} 3
NODE_RENAMED {{ unimplemented_inline() }} 4
NODE_ADOPTED 5

Specification

DOM Level 3 Core: UserDataHandler

See also

Revision Source

<p>{{ DomRef() }}</p>
<h3>Summary</h3>
<p>When associating user data with a key on a node, <code><a class="internal" href="/En/DOM/Node.setUserData" title="En/DOM/Node.setUserData">Node.setUserData</a>()</code> can also accept, in its third argument, a handler which will be called when the object is cloned, imported, deleted, renamed, or adopted. Per the specification, exceptions should not be thrown in a <code>UserDataHandler</code>. In both <code><a class="internal" href="/en/DOM/document.importNode" title="En/DOM/document.importNode">document.importNode</a>()</code> and <code><a class="internal" href="/En/DOM/Node.cloneNode" title="En/DOM/Node.cloneNode">Node.cloneNode</a>()</code>, although user data is not copied over, the handler will be called.</p>
<h3>Properties</h3>
<p>None</p>
<h3>Methods</h3>
<p><code><a href="/En/DOM/UserDataHandler.handle" title="En/DOM/UserDataHandler.handle">handle</a> ( operationInt, keyString, DOMUserData, srcNode, dstNode )</code> (no return)</p>
<h3>Constants</h3>
<p><code>NODE_RENAMED</code> is currently not supported since <code><a href="/En/DOM/Node.renameNode" title="En/DOM/Node.renameNode">Node.renameNode</a>()</code> is not supported.</p>
<table class="standard-table"> <tbody> <tr> <td>Constant</td> <td>Value</td> </tr> <tr> <td><code>NODE_CLONED</code></td> <td>1</td> </tr> <tr> <td><code>NODE_IMPORTED</code></td> <td>2</td> </tr> <tr> <td><code>NODE_DELETED</code> {{ unimplemented_inline("550400") }}</td> <td>3</td> </tr> <tr> <td><code>NODE_RENAMED</code> {{ unimplemented_inline() }}</td> <td>4</td> </tr> <tr> <td><code>NODE_ADOPTED</code></td> <td>5</td> </tr> </tbody>
</table>
<h3>Specification</h3>
<p><a class=" external" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#UserDataHandler">DOM Level 3 Core: UserDataHandler</a></p>
<h3>See also</h3>
<ul> <li><a href="/En/DOM/DOMUserData" title="En/DOM/DOMUserData"><code>DOMUserData</code></a></li> <li><a href="/En/DOM/Node.getUserData" title="En/DOM/Node.getUserData"><code>Node.getUserData</code></a>, <a href="/En/DOM/Node.setUserData" title="En/DOM/Node.setUserData"><code>Node.setUserData</code></a></li>
</ul>
Revert to this revision