mozilla

Revision 60015 of UserDataHandler

  • Revision slug: DOM/UserDataHandler
  • Revision title: UserDataHandler
  • Revision id: 60015
  • Created:
  • Creator: Brettz9
  • Is current revision? No
  • Comment 7 words added, 17 words removed

Revision Content

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. NODE_RENAMED is currently not supported since Node.renameNode() is not supported, and NODE_DELETED is not supported . The other types are supported.

Properties

None

Methods

 

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

 

Constants

Constant Value
NODE_CLONED 1
NODE_IMPORTED 2
NODE_DELETED 3
NODE_RENAMED 4
NODE_ADOPTED 5

Revision Source

<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 UserDataHandler. In both <a class="internal" href="/en/DOM/document.importNode" title="En/DOM/document.importNode">document.importNode</a>() and <a class="internal" href="/En/DOM/Node.cloneNode" title="En/DOM/Node.cloneNode">Node.cloneNode</a>(), although user data is not copied over, the handler will be called. NODE_RENAMED is currently not supported since <a href="/En/DOM/Node.renameNode" title="En/DOM/Node.renameNode">Node.renameNode</a>() is not supported, and NODE_DELETED is <a class=" link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=550400" title="https://bugzilla.mozilla.org/show_bug.cgi?id=550400">not supported</a> . The other types are supported.</p>
<h3>Properties</h3>
<p>None</p>
<h3>Methods</h3>
<p> </p>
<p><a class="internal" href="/En/DOM/UserDataHandler.handle" title="En/DOM/UserDataHandler.handle">handle</a> ( operationInt, keyString, DOMUserData, srcNode, dstNode )  (no return)</p>
<p> </p>
<h3>Constants</h3>
<table border="1" cellpadding="1" cellspacing="1" width="200"> <tbody> <tr> <td>Constant</td> <td>Value</td> </tr> <tr> <td><span style="font-family: Courier New;">NODE_CLONED</span></td> <td>1</td> </tr> <tr> <td><span style="font-family: Courier New;">NODE_IMPORTED</span></td> <td>2</td> </tr> <tr> <td><span style="font-family: Courier New;">NODE_DELETED</span></td> <td>3</td> </tr> <tr> <td><span style="font-family: Courier New;">NODE_RENAMED</span></td> <td>4</td> </tr> <tr> <td><span style="font-family: Courier New;">NODE_ADOPTED</span></td> <td>5</td> </tr> </tbody>
</table>
Revert to this revision