1 |
wakaba |
1.1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
2 |
|
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
3 |
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
4 |
|
|
<head> |
5 |
|
|
<title>Known HTML Character Entity Reference, |
6 |
|
|
with XHTML 1.1 DOCTYPE Declaration</title> |
7 |
|
|
</head> |
8 |
|
|
<body> |
9 |
|
|
<h1>Known HTML Character Entity Reference, with XHTML 1.1 |
10 |
|
|
<code>DOCTYPE</code> Declaration</h1> |
11 |
|
|
|
12 |
|
|
<h2>Test</h2> |
13 |
|
|
|
14 |
|
|
<dl id="test-list"> |
15 |
|
|
<dt><code>&copy;</code> is rendered as</dt><dd>©</dd> |
16 |
|
|
<dt><code>&#xA9;</code> is rendered as</dt><dd>©</dd> |
17 |
|
|
</dl> |
18 |
|
|
|
19 |
|
|
<p>The <code>innerHTML</code> of the list above is:</p> |
20 |
|
|
<pre id="test-source"></pre> |
21 |
wakaba |
1.2 |
|
22 |
|
|
|
23 |
|
|
<p>About the first <code>dd</code> element:</p> |
24 |
|
|
<ul id="test-nodes"> |
25 |
|
|
<li>[There is no child.]</li> |
26 |
|
|
</ul> |
27 |
|
|
|
28 |
wakaba |
1.1 |
<script type="text/javascript"> |
29 |
wakaba |
1.2 |
var list = document.getElementById ('test-list'); |
30 |
wakaba |
1.1 |
document.getElementById ('test-source').appendChild |
31 |
wakaba |
1.2 |
(document.createTextNode (list.innerHTML)); |
32 |
|
|
|
33 |
|
|
var listc = list.getElementsByTagName ('dd')[0].childNodes; |
34 |
|
|
var ul = document.getElementById ('test-nodes'); |
35 |
|
|
if (listc.length > 0) { |
36 |
|
|
ul.textContent = ""; |
37 |
|
|
ul.innerText = ""; |
38 |
|
|
} |
39 |
|
|
for (var i = 0; listc.length > i; i++) { |
40 |
|
|
var listcn = listc[i]; |
41 |
|
|
var li = document.createElementNS ("http://www.w3.org/1999/xhtml", 'li'); |
42 |
|
|
li.appendChild (document.createTextNode |
43 |
|
|
(i + "th child is of type |" + listcn.nodeType + |
44 |
|
|
"| with name |" + listcn.nodeName + "|, value |" + |
45 |
|
|
listcn.nodeValue + "|.")); |
46 |
|
|
ul.appendChild (li); |
47 |
|
|
} |
48 |
wakaba |
1.1 |
</script> |
49 |
|
|
|
50 |
|
|
<h2>Expected Result</h2> |
51 |
|
|
|
52 |
|
|
<dl> |
53 |
|
|
<dt><a href="http://www.w3.org/TR/2002/REC-xhtml1-20020801/#uaconf">Conforming XHTML 1.0 User Agent</a></dt> |
54 |
|
|
<dd>Both references are treated as <code>COPYRIGHT SIGN</code>s.</dd> |
55 |
|
|
<dt><a href="http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/conformance.html#s_conform_user_agent">Conforming XHTML Family User Agent</a></dt> |
56 |
|
|
<dd>The character reference (later) is treated as a |
57 |
|
|
<code>COPYRIGHT SIGN</code>.</dd> |
58 |
|
|
<dd>A user agent that reads external entities (or that has |
59 |
|
|
builtin knowledge on the XHTML 1.1 document type) will treat |
60 |
|
|
the entity reference (former) as a <code>COPYRIGHT SIGN</code>.</dd> |
61 |
|
|
<dd>A user agent that does not read the external entity in which |
62 |
|
|
the entity declaration for the general entity <code>copy</code> |
63 |
|
|
(nor have any builtin knowledge on the document type) |
64 |
|
|
will render it as a sequence of six characters: |
65 |
|
|
<code>&copy;</code>.</dd> |
66 |
|
|
</dl> |
67 |
|
|
|
68 |
|
|
<h2>Discussion</h2> |
69 |
|
|
|
70 |
|
|
<p>See a <a href="http://suika.fam.cx/gate/2005/sw/">SuikaWiki</a> article on <a href="http://suika.fam.cx/gate/2005/sw/XHTML/%E5%AE%9F%E4%BD%93%E5%8F%82%E7%85%A7">entity references in XHTML documents</a>.</p> |
71 |
|
|
|
72 |
|
|
</body> |
73 |
|
|
</html> |