blob: e02c3e5c2e5b9ff1364fd4bc7c40fd7c0d17a545 [file] [log] [blame]
abarth@webkit.org712ae042010-09-21 19:37:13 +00001<!doctype html>
2<title>Entities in attributes</title>
3<script>
rniwa@webkit.org224c8b52012-08-04 01:13:22 +00004if (window.testRunner)
5 testRunner.dumpAsText();
abarth@webkit.org712ae042010-09-21 19:37:13 +00006
7window.onload = function() {
8
9 var entities = [
10 "AElig;",
11 "AElig",
12 "AMP;",
13 "AMP",
14 "Aacute;",
15 "Aacute",
16 "Acirc;",
17 "Acirc",
18 "Agrave;",
19 "Agrave",
20 "Alpha;",
21 "Aring;",
22 "Aring",
23 "Atilde;",
24 "Atilde",
25 "Auml;",
26 "Auml",
27 "Beta;",
28 "COPY;",
29 "COPY",
30 "Ccedil;",
31 "Ccedil",
32 "Chi;",
33 "Dagger;",
34 "Delta;",
35 "ETH;",
36 "ETH",
37 "Eacute;",
38 "Eacute",
39 "Ecirc;",
40 "Ecirc",
41 "Egrave;",
42 "Egrave",
43 "Epsilon;",
44 "Eta;",
45 "Euml;",
46 "Euml",
47 "GT;",
48 "GT",
49 "Gamma;",
50 "Iacute;",
51 "Iacute",
52 "Icirc;",
53 "Icirc",
54 "Igrave;",
55 "Igrave",
56 "Iota;",
57 "Iuml;",
58 "Iuml",
59 "Kappa;",
60 "LT;",
61 "LT",
62 "Lambda;",
63 "Mu;",
64 "Ntilde;",
65 "Ntilde",
66 "Nu;",
67 "OElig;",
68 "Oacute;",
69 "Oacute",
70 "Ocirc;",
71 "Ocirc",
72 "Ograve;",
73 "Ograve",
74 "Omega;",
75 "Omicron;",
76 "Oslash;",
77 "Oslash",
78 "Otilde;",
79 "Otilde",
80 "Ouml;",
81 "Ouml",
82 "Phi;",
83 "Pi;",
84 "Prime;",
85 "Psi;",
86 "QUOT;",
87 "QUOT",
88 "REG;",
89 "REG",
90 "Rho;",
91 "Scaron;",
92 "Sigma;",
93 "THORN;",
94 "THORN",
95 "TRADE;",
96 "Tau;",
97 "Theta;",
98 "Uacute;",
99 "Uacute",
100 "Ucirc;",
101 "Ucirc",
102 "Ugrave;",
103 "Ugrave",
104 "Upsilon;",
105 "Uuml;",
106 "Uuml",
107 "Xi;",
108 "Yacute;",
109 "Yacute",
110 "Yuml;",
111 "Zeta;",
112 "aacute;",
113 "aacute",
114 "acirc;",
115 "acirc",
116 "acute;",
117 "acute",
118 "aelig;",
119 "aelig",
120 "agrave;",
121 "agrave",
122 "alefsym;",
123 "alpha;",
124 "amp;",
125 "amp",
126 "and;",
127 "ang;",
128 "apos;",
129 "aring;",
130 "aring",
131 "asymp;",
132 "atilde;",
133 "atilde",
134 "auml;",
135 "auml",
136 "bdquo;",
137 "beta;",
138 "brvbar;",
139 "brvbar",
140 "bull;",
141 "cap;",
142 "ccedil;",
143 "ccedil",
144 "cedil;",
145 "cedil",
146 "cent;",
147 "cent",
148 "chi;",
149 "circ;",
150 "clubs;",
151 "cong;",
152 "copy;",
153 "copy",
154 "crarr;",
155 "cup;",
156 "curren;",
157 "curren",
158 "dArr;",
159 "dagger;",
160 "darr;",
161 "deg;",
162 "deg",
163 "delta;",
164 "diams;",
165 "divide;",
166 "divide",
167 "eacute;",
168 "eacute",
169 "ecirc;",
170 "ecirc",
171 "egrave;",
172 "egrave",
173 "empty;",
174 "emsp;",
175 "ensp;",
176 "epsilon;",
177 "equiv;",
178 "eta;",
179 "eth;",
180 "eth",
181 "euml;",
182 "euml",
183 "euro;",
184 "exist;",
185 "fnof;",
186 "forall;",
187 "frac12;",
188 "frac12",
189 "frac14;",
190 "frac14",
191 "frac34;",
192 "frac34",
193 "frasl;",
194 "gamma;",
195 "ge;",
196 "gt;",
197 "gt",
198 "hArr;",
199 "harr;",
200 "hearts;",
201 "hellip;",
202 "iacute;",
203 "iacute",
204 "icirc;",
205 "icirc",
206 "iexcl;",
207 "iexcl",
208 "igrave;",
209 "igrave",
210 "image;",
211 "infin;",
212 "int;",
213 "iota;",
214 "iquest;",
215 "iquest",
216 "isin;",
217 "iuml;",
218 "iuml",
219 "kappa;",
220 "lArr;",
221 "lambda;",
222 "lang;",
223 "laquo;",
224 "laquo",
225 "larr;",
226 "lceil;",
227 "ldquo;",
228 "le;",
229 "lfloor;",
230 "lowast;",
231 "loz;",
232 "lrm;",
233 "lsaquo;",
234 "lsquo;",
235 "lt;",
236 "lt",
237 "macr;",
238 "macr",
239 "mdash;",
240 "micro;",
241 "micro",
242 "middot;",
243 "middot",
244 "minus;",
245 "mu;",
246 "nabla;",
247 "nbsp;",
248 "nbsp",
249 "ndash;",
250 "ne;",
251 "ni;",
252 "not;",
253 "not",
254 "notin;",
255 "nsub;",
256 "ntilde;",
257 "ntilde",
258 "nu;",
259 "oacute;",
260 "oacute",
261 "ocirc;",
262 "ocirc",
263 "oelig;",
264 "ograve;",
265 "ograve",
266 "oline;",
267 "omega;",
268 "omicron;",
269 "oplus;",
270 "or;",
271 "ordf;",
272 "ordf",
273 "ordm;",
274 "ordm",
275 "oslash;",
276 "oslash",
277 "otilde;",
278 "otilde",
279 "otimes;",
280 "ouml;",
281 "ouml",
282 "para;",
283 "para",
284 "part;",
285 "permil;",
286 "perp;",
287 "phi;",
288 "pi;",
289 "piv;",
290 "plusmn;",
291 "plusmn",
292 "pound;",
293 "pound",
294 "prime;",
295 "prod;",
296 "prop;",
297 "psi;",
298 "quot;",
299 "quot",
300 "rArr;",
301 "radic;",
302 "rang;",
303 "raquo;",
304 "raquo",
305 "rarr;",
306 "rceil;",
307 "rdquo;",
308 "real;",
309 "reg;",
310 "reg",
311 "rfloor;",
312 "rho;",
313 "rlm;",
314 "rsaquo;",
315 "rsquo;",
316 "sbquo;",
317 "scaron;",
318 "sdot;",
319 "sect;",
320 "sect",
321 "shy;",
322 "shy",
323 "sigma;",
324 "sigmaf;",
325 "sim;",
326 "spades;",
327 "sub;",
328 "sube;",
329 "sum;",
330 "sup1;",
331 "sup1",
332 "sup2;",
333 "sup2",
334 "sup3;",
335 "sup3",
336 "sup;",
337 "supe;",
338 "szlig;",
339 "szlig",
340 "tau;",
341 "there4;",
342 "theta;",
343 "thetasym;",
344 "thinsp;",
345 "thorn;",
346 "thorn",
347 "tilde;",
348 "times;",
349 "times",
350 "trade;",
351 "uArr;",
352 "uacute;",
353 "uacute",
354 "uarr;",
355 "ucirc;",
356 "ucirc",
357 "ugrave;",
358 "ugrave",
359 "uml;",
360 "uml",
361 "upsih;",
362 "upsilon;",
363 "uuml;",
364 "uuml",
365 "weierp;",
366 "xi;",
367 "yacute;",
368 "yacute",
369 "yen;",
370 "yen",
371 "yuml;",
372 "yuml",
373 "zeta;",
374 "zwj;",
375 "zwnj;"
376 ];
377
378 var characters = [
379 "\u00C6",
380 "\u00C6",
381 "\u0026",
382 "\u0026",
383 "\u00C1",
384 "\u00C1",
385 "\u00C2",
386 "\u00C2",
387 "\u00C0",
388 "\u00C0",
389 "\u0391",
390 "\u00C5",
391 "\u00C5",
392 "\u00C3",
393 "\u00C3",
394 "\u00C4",
395 "\u00C4",
396 "\u0392",
397 "\u00A9",
398 "\u00A9",
399 "\u00C7",
400 "\u00C7",
401 "\u03A7",
402 "\u2021",
403 "\u0394",
404 "\u00D0",
405 "\u00D0",
406 "\u00C9",
407 "\u00C9",
408 "\u00CA",
409 "\u00CA",
410 "\u00C8",
411 "\u00C8",
412 "\u0395",
413 "\u0397",
414 "\u00CB",
415 "\u00CB",
416 "\u003E",
417 "\u003E",
418 "\u0393",
419 "\u00CD",
420 "\u00CD",
421 "\u00CE",
422 "\u00CE",
423 "\u00CC",
424 "\u00CC",
425 "\u0399",
426 "\u00CF",
427 "\u00CF",
428 "\u039A",
429 "\u003C",
430 "\u003C",
431 "\u039B",
432 "\u039C",
433 "\u00D1",
434 "\u00D1",
435 "\u039D",
436 "\u0152",
437 "\u00D3",
438 "\u00D3",
439 "\u00D4",
440 "\u00D4",
441 "\u00D2",
442 "\u00D2",
443 "\u03A9",
444 "\u039F",
445 "\u00D8",
446 "\u00D8",
447 "\u00D5",
448 "\u00D5",
449 "\u00D6",
450 "\u00D6",
451 "\u03A6",
452 "\u03A0",
453 "\u2033",
454 "\u03A8",
455 "\u0022",
456 "\u0022",
457 "\u00AE",
458 "\u00AE",
459 "\u03A1",
460 "\u0160",
461 "\u03A3",
462 "\u00DE",
463 "\u00DE",
464 "\u2122",
465 "\u03A4",
466 "\u0398",
467 "\u00DA",
468 "\u00DA",
469 "\u00DB",
470 "\u00DB",
471 "\u00D9",
472 "\u00D9",
473 "\u03A5",
474 "\u00DC",
475 "\u00DC",
476 "\u039E",
477 "\u00DD",
478 "\u00DD",
479 "\u0178",
480 "\u0396",
481 "\u00E1",
482 "\u00E1",
483 "\u00E2",
484 "\u00E2",
485 "\u00B4",
486 "\u00B4",
487 "\u00E6",
488 "\u00E6",
489 "\u00E0",
490 "\u00E0",
491 "\u2135",
492 "\u03B1",
493 "\u0026",
494 "\u0026",
495 "\u2227",
496 "\u2220",
497 "\u0027",
498 "\u00E5",
499 "\u00E5",
500 "\u2248",
501 "\u00E3",
502 "\u00E3",
503 "\u00E4",
504 "\u00E4",
505 "\u201E",
506 "\u03B2",
507 "\u00A6",
508 "\u00A6",
509 "\u2022",
510 "\u2229",
511 "\u00E7",
512 "\u00E7",
513 "\u00B8",
514 "\u00B8",
515 "\u00A2",
516 "\u00A2",
517 "\u03C7",
518 "\u02C6",
519 "\u2663",
520 "\u2245",
521 "\u00A9",
522 "\u00A9",
523 "\u21B5",
524 "\u222A",
525 "\u00A4",
526 "\u00A4",
527 "\u21D3",
528 "\u2020",
529 "\u2193",
530 "\u00B0",
531 "\u00B0",
532 "\u03B4",
533 "\u2666",
534 "\u00F7",
535 "\u00F7",
536 "\u00E9",
537 "\u00E9",
538 "\u00EA",
539 "\u00EA",
540 "\u00E8",
541 "\u00E8",
542 "\u2205",
543 "\u2003",
544 "\u2002",
545 "\u03B5",
546 "\u2261",
547 "\u03B7",
548 "\u00F0",
549 "\u00F0",
550 "\u00EB",
551 "\u00EB",
552 "\u20AC",
553 "\u2203",
554 "\u0192",
555 "\u2200",
556 "\u00BD",
557 "\u00BD",
558 "\u00BC",
559 "\u00BC",
560 "\u00BE",
561 "\u00BE",
562 "\u2044",
563 "\u03B3",
564 "\u2265",
565 "\u003E",
566 "\u003E",
567 "\u21D4",
568 "\u2194",
569 "\u2665",
570 "\u2026",
571 "\u00ED",
572 "\u00ED",
573 "\u00EE",
574 "\u00EE",
575 "\u00A1",
576 "\u00A1",
577 "\u00EC",
578 "\u00EC",
579 "\u2111",
580 "\u221E",
581 "\u222B",
582 "\u03B9",
583 "\u00BF",
584 "\u00BF",
585 "\u2208",
586 "\u00EF",
587 "\u00EF",
588 "\u03BA",
589 "\u21D0",
590 "\u03BB",
591 "\u27e8",
592 "\u00AB",
593 "\u00AB",
594 "\u2190",
595 "\u2308",
596 "\u201C",
597 "\u2264",
598 "\u230A",
599 "\u2217",
600 "\u25CA",
601 "\u200E",
602 "\u2039",
603 "\u2018",
604 "\u003C",
605 "\u003C",
606 "\u00AF",
607 "\u00AF",
608 "\u2014",
609 "\u00B5",
610 "\u00B5",
611 "\u00B7",
612 "\u00B7",
613 "\u2212",
614 "\u03BC",
615 "\u2207",
616 "\u00A0",
617 "\u00A0",
618 "\u2013",
619 "\u2260",
620 "\u220B",
621 "\u00AC",
622 "\u00AC",
623 "\u2209",
624 "\u2284",
625 "\u00F1",
626 "\u00F1",
627 "\u03BD",
628 "\u00F3",
629 "\u00F3",
630 "\u00F4",
631 "\u00F4",
632 "\u0153",
633 "\u00F2",
634 "\u00F2",
635 "\u203E",
636 "\u03C9",
637 "\u03BF",
638 "\u2295",
639 "\u2228",
640 "\u00AA",
641 "\u00AA",
642 "\u00BA",
643 "\u00BA",
644 "\u00F8",
645 "\u00F8",
646 "\u00F5",
647 "\u00F5",
648 "\u2297",
649 "\u00F6",
650 "\u00F6",
651 "\u00B6",
652 "\u00B6",
653 "\u2202",
654 "\u2030",
655 "\u22A5",
656 "\u03C6",
657 "\u03C0",
658 "\u03D6",
659 "\u00B1",
660 "\u00B1",
661 "\u00A3",
662 "\u00A3",
663 "\u2032",
664 "\u220F",
665 "\u221D",
666 "\u03C8",
667 "\u0022",
668 "\u0022",
669 "\u21D2",
670 "\u221A",
671 "\u27e9",
672 "\u00BB",
673 "\u00BB",
674 "\u2192",
675 "\u2309",
676 "\u201D",
677 "\u211C",
678 "\u00AE",
679 "\u00AE",
680 "\u230B",
681 "\u03C1",
682 "\u200F",
683 "\u203A",
684 "\u2019",
685 "\u201A",
686 "\u0161",
687 "\u22C5",
688 "\u00A7",
689 "\u00A7",
690 "\u00AD",
691 "\u00AD",
692 "\u03C3",
693 "\u03C2",
694 "\u223C",
695 "\u2660",
696 "\u2282",
697 "\u2286",
698 "\u2211",
699 "\u00B9",
700 "\u00B9",
701 "\u00B2",
702 "\u00B2",
703 "\u00B3",
704 "\u00B3",
705 "\u2283",
706 "\u2287",
707 "\u00DF",
708 "\u00DF",
709 "\u03C4",
710 "\u2234",
711 "\u03B8",
712 "\u03D1",
713 "\u2009",
714 "\u00FE",
715 "\u00FE",
716 "\u02DC",
717 "\u00D7",
718 "\u00D7",
719 "\u2122",
720 "\u21D1",
721 "\u00FA",
722 "\u00FA",
723 "\u2191",
724 "\u00FB",
725 "\u00FB",
726 "\u00F9",
727 "\u00F9",
728 "\u00A8",
729 "\u00A8",
730 "\u03D2",
731 "\u03C5",
732 "\u00FC",
733 "\u00FC",
734 "\u2118",
735 "\u03BE",
736 "\u00FD",
737 "\u00FD",
738 "\u00A5",
739 "\u00A5",
740 "\u00FF",
741 "\u00FF",
742 "\u03B6",
743 "\u200D",
744 "\u200C"
745 ];
746
747 var log = "";
748 var elm = document.getElementsByTagName("p")[0];
749 var entity, character, characterCode, result, resultCode;
750 for (var i = 0, len = entities.length; i < len; ++i) {
751 entity = entities[i];
752 character = characters[i];
753 resultCode = characterCode = "";
754 elm.innerHTML = "<span title='&" + entity + "X'></span>";
755 result = elm.firstChild.title.split("X")[0];
756 if (result.length == 1)
757 resultCode = " (\\u" + result.charCodeAt(0).toString(16) + ")";
758 if (character.length == 1)
759 characterCode = " (\\u" + character.charCodeAt(0).toString(16) + ")";
760 if (/;$/.test(entity)) {
761 if (result != character)
762 log += entity + " (was: " + result + resultCode + ", expected: " + character + characterCode + ")\n";
763 } else {
764 if (result != "&" + entity)
765 log += entity + " (was: " + result + resultCode + ", expected: &" + entity + ")\n";
766 }
767 }
768 if (log == "")
769 elm.innerHTML = "PASS";
770 else
771 document.body.innerHTML = "<plaintext>FAIL:\n\n" + log;
772}
773</script>
774<p>FAIL (script didn't run)</p>