~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/dom/tests/js/docfrag.html

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<SCRIPT>
 
4
function docFragAppendTest() {
 
5
  var d = document.createDocumentFragment();
 
6
  d.appendChild(document.createTextNode(" Hello"));
 
7
  var b = document.createElement("B")
 
8
  b.appendChild(document.createTextNode(" there"));
 
9
  d.appendChild(b);
 
10
  p = document.getElementById("appendTest");
 
11
  p.appendChild(d);
 
12
  alert("This number should be 0: " + d.childNodes.length);
 
13
}
 
14
function docFragReplaceTest() {
 
15
  var d = document.createDocumentFragment();
 
16
  d.appendChild(document.createTextNode(" new"));
 
17
  var b = document.createElement("B")
 
18
  b.appendChild(document.createTextNode(" ones"));
 
19
  d.appendChild(b);
 
20
  p = document.getElementById("replaceTest");
 
21
  s = document.getElementById("replaceSpan");
 
22
  if (null != s) {
 
23
    p.replaceChild(d, s);
 
24
  }
 
25
  alert("This number should be 0: " + d.childNodes.length);
 
26
}
 
27
</SCRIPT>
 
28
</HEAD>
 
29
<BODY>
 
30
<H1>Document Fragment test</H1>
 
31
 
 
32
<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>
 
33
 
 
34
<P ID="replaceTest">
 
35
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>.
 
36
</P>
 
37
 
 
38
</BODY>
 
39
</HTML>
 
 
b'\\ No newline at end of file'