3 <TITLE>Attributes test
</TITLE>
5 <BODY bgColor=
"#ffffff" text=
"#000000">
6 <H1>Attributes test
</H1>
8 <P>You should see the following in the console:
</P>
10 attribute.getNamedItem == getAttributeNode: true
11 attribute BGCOLOR=#ffffff
12 changing attribute node value changes attribute value: true
13 return value of removeNamedItem is attribute node: true
14 removing attribute changes attribute count: true
15 changing disembodied attribute value works: true
16 removing attribute node removes attribute: true
19 <P>The text should turn green and then you should see
20 the following in the console:
</P>
22 setting an existing attribute returns the old node: true
26 a = document.body.attributes.getNamedItem(
"bgcolor")
27 a2 = document.body.getAttributeNode(
"bgcolor")
28 n = document.body.attributes.length;
29 dump(
"attribute.getNamedItem == getAttributeNode: " + (a == a2) +
"\n");
31 dump(
"attribute " + a.name +
"=" + a.value +
"\n");
34 dump(
"changing attribute node value changes attribute value: " + (document.body.getAttribute(
"bgcolor") ==
"#00ffff") +
"\n");
36 a = document.body.attributes.removeNamedItem(
"bgcolor")
37 dump(
"return value of removeNamedItem is attribute node: " + (a == a2) +
"\n");
39 dump(
"removing attribute changes attribute count: " + (document.body.attributes.length == (n-
1)) +
"\n");
42 dump(
"changing disembodied attribute value works: " + (a.value ==
"#ff0000") +
"\n");
44 dump(
"removing attribute node removes attribute: " + (document.body.getAttribute(
"bgcolor") ==
"") +
"\n");
46 a = document.body.attributes.getNamedItem(
"TEXT");
47 a2 = document.createAttribute(
"text");
49 a3 = document.body.attributes.setNamedItem(a2);
50 dump(
"setting an existing attribute returns the old node: " + (a == a3) +
"\n");