6 var paragraph
= document
.createElement("p");
7 paragraph
.appendChild(document
.createTextNode(message
));
8 document
.getElementById("console").appendChild(paragraph
);
11 function expect(expected
, actual
)
13 var msg
= "Expected " + expected
+ ", got " + actual
+ ": ";
14 if (expected
== actual
)
20 function createTitleElement(title
)
22 var t
= document
.createElement('title');
23 t
.appendChild(document
.createTextNode(title
));
29 if (window
.testRunner
)
30 testRunner
.dumpAsText();
32 var head
= document
.getElementsByTagName('head')[0];
34 expect('', document
.title
);
35 head
.appendChild(createTitleElement('First title'));
36 expect('First title', document
.title
);
37 document
.title
= 'Second title';
38 expect('Second title', document
.title
);
39 head
.appendChild(createTitleElement('Third title'));
40 expect('Second title', document
.title
);
41 document
.title
= 'Fourth title';
42 expect('Fourth title', document
.title
);
44 var titles
= head
.getElementsByTagName('title');
45 var expectedTitles
= {1: 'Third title', 0: ''};
46 while (titles
.length
) {
47 titles
[0].parentNode
.removeChild(titles
[0]);
48 expect(expectedTitles
[titles
.length
], document
.title
);
51 head
.appendChild(createTitleElement('Fifth title'));
52 expect('Fifth title', document
.title
);
57 <p>Test for
<a href='http://bugs.webkit.org/show_bug.cgi?id=
11692'
>http://bugs.webkit.org/show_bug.cgi?id=
11692</a>.
58 If the title has been explicitly set via document.title, any further
<title
> tags parsed should not effect
59 the document title.
</p>