<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>

<!--

Copyright (c) 2004 World Wide Web Consortium, 
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University).  All 
Rights Reserved.  This program is distributed under the W3C's Software
Intellectual Property License.  This program is distributed in the 
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.  

See W3C License http://www.w3.org/Consortium/Legal/ for more details.

-->

<!DOCTYPE test SYSTEM "dom3.dtd">
<test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-3" name="userdatahandler02">
<metadata>
<title>userdatahandler02</title>
<creator>Curt Arnold</creator>
<description>
Call setUserData on a node providing a UserDataHandler and clone the node.
</description>
<date qualifier="created">2004-01-16</date>
<subject resource="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#ID-handleUserDataEvent"/>
</metadata>
<var name="doc" type="Document"/>
<var name="node" type="Node"/>
<var name="pList" type="NodeList"/>
<var name="userDataMonitor" type="UserDataMonitor"/>
<var name="oldUserData" type="DOMUserData"/>
<var name="elementNS" type="DOMString"/>
<var name="newNode" type="Node"/>
<var name="notifications" type="List"/>
<var name="notification" type="UserDataNotification"/>
<var name="operation" type="short"/>
<var name="key" type="DOMString"/>
<var name="data" type="DOMString"/>
<var name="src" type="Node"/>
<var name="dst" type="Node"/>
<var name="greetingCount" type="int" value="0"/>
<var name="salutationCount" type="int" value="0"/>
<var name="hello" type="DOMString" value='"Hello"'/>
<var name="mister" type="DOMString" value='"Mr."'/>

<load var="doc" href="barfoo" willBeModified="true"/>
<getElementsByTagName var="pList" obj="doc" tagname='"p"' interface="Document"/>
<item var="node" obj="pList" index="0" interface="NodeList"/>
<setUserData var="oldUserData" obj="node" key='"greeting"' data='hello' handler="userDataMonitor"/>
<setUserData var="oldUserData" obj="node" key='"salutation"' data='mister' handler="userDataMonitor"/>
<namespaceURI var="elementNS" obj="node" interface="Node"/>
<cloneNode var="newNode" obj="node" deep="true"/>
<allNotifications var="notifications" obj="userDataMonitor"/>
<assertSize size="2" collection="notifications" id="twoNotifications"/>
<for-each member="notification" collection="notifications">
	<operation var="operation" obj="notification"/>
	<assertEquals actual="operation" expected="1" ignoreCase="false" id="operationIsClone"/>
	<key var="key" obj="notification"/>
	<data var="data" obj="notification" interface="UserDataNotification"/>
	<if>
		<equals actual="key" expected='"greeting"' ignoreCase="false"/>
		<assertEquals actual="data" expected='hello' ignoreCase="false" id="greetingDataHello"/>
		<increment var="greetingCount" value="1"/>
		<else>
			<assertEquals actual="key" expected='"salutation"' ignoreCase="false" id="saluationKey"/>
			<assertEquals actual="data" expected='mister' ignoreCase="false" id="salutationDataMr"/>
			<increment var="salutationCount" value="1"/>
		</else>
	</if>
	<src interface="UserDataNotification" var="src" obj="notification"/>
	<assertSame actual="src" expected="node" id="srcIsNode"/>
	<dst var="dst" obj="notification"/>
	<assertSame actual="dst" expected="newNode" id="dstIsNewNode"/>
</for-each>
<assertEquals actual="greetingCount" expected="1" ignoreCase="false" id="greetingCountIs1"/>
<assertEquals actual="salutationCount" expected="1" ignoreCase="false" id="salutationCountIs1"/>
</test>
