docfrag test
git-svn-id: svn://10.0.0.236/trunk@15452 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
a8e89e05c1
commit
b5d3af627a
39
mozilla/dom/tests/js/docfrag.html
Normal file
39
mozilla/dom/tests/js/docfrag.html
Normal file
@ -0,0 +1,39 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<SCRIPT>
|
||||
function docFragAppendTest() {
|
||||
var d = document.createDocumentFragment();
|
||||
d.appendChild(document.createTextNode(" Hello"));
|
||||
var b = document.createElement("B")
|
||||
b.appendChild(document.createTextNode(" there"));
|
||||
d.appendChild(b);
|
||||
p = document.getElementById("appendTest");
|
||||
p.appendChild(d);
|
||||
alert("This number should be 0: " + d.childNodes.length);
|
||||
}
|
||||
function docFragReplaceTest() {
|
||||
var d = document.createDocumentFragment();
|
||||
d.appendChild(document.createTextNode(" new"));
|
||||
var b = document.createElement("B")
|
||||
b.appendChild(document.createTextNode(" ones"));
|
||||
d.appendChild(b);
|
||||
p = document.getElementById("replaceTest");
|
||||
s = document.getElementById("replaceSpan");
|
||||
if (null != s) {
|
||||
p.replaceChild(d, s);
|
||||
}
|
||||
alert("This number should be 0: " + d.childNodes.length);
|
||||
}
|
||||
</SCRIPT>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>Document Fragment test</H1>
|
||||
|
||||
<P ID="appendTest">If this test works, clicking on this <A href="" onclick="docFragAppendTest(); return false;">link</A> will add two words to the end of this paragraph.</P>
|
||||
|
||||
<P ID="replaceTest">
|
||||
Clicking on this <A href="" onclick="docFragReplaceTest(); return false;">link</A> will replace the following two words with new ones: <span id="replaceSpan">two words</span>.
|
||||
</P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
Loading…
x
Reference in New Issue
Block a user