mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:57:35 +00:00
LibWeb/HTML: Implement text attribute in HTMLTitleElement
This commit is contained in:
parent
d6df13af6a
commit
24b9d05ea8
5 changed files with 48 additions and 19 deletions
|
@ -3,12 +3,16 @@
|
|||
2b: 1
|
||||
2c: "This is a title!"
|
||||
2d: "This is a title!"
|
||||
3: ""
|
||||
4a: 3
|
||||
4b: ""
|
||||
4c: ""
|
||||
4d: ""
|
||||
4e: 3
|
||||
4f: "This is another title!"
|
||||
4g: ""
|
||||
4h: ""
|
||||
3a: "This is a title!"
|
||||
3b: "This is a title!"
|
||||
3c: "Another title!"
|
||||
3d: "Another title!"
|
||||
4: ""
|
||||
5a: 3
|
||||
5b: ""
|
||||
5c: ""
|
||||
5d: ""
|
||||
5e: 3
|
||||
5f: "This is another title!"
|
||||
5g: ""
|
||||
5h: ""
|
||||
|
|
|
@ -15,9 +15,17 @@
|
|||
println(`2c: "${titleElements[0].innerText}"`);
|
||||
println(`2d: "${document.title}"`);
|
||||
|
||||
// Getting and setting the title's text attribute.
|
||||
println(`3a: "${titleElements[0].text}"`);
|
||||
println(`3b: "${document.title}"`);
|
||||
|
||||
titleElements[0].text = "Another title!";
|
||||
println(`3c: "${titleElements[0].text}"`);
|
||||
println(`3d: "${document.title}"`);
|
||||
|
||||
// Removing the title element sets the title back to default.
|
||||
titleElements[0].remove();
|
||||
println(`3: "${document.title}"`);
|
||||
println(`4: "${document.title}"`);
|
||||
|
||||
// After adding several title elements to the body, setting the title updates the text
|
||||
// content of only the first title element.
|
||||
|
@ -26,17 +34,17 @@
|
|||
document.body.appendChild(document.createElement('title'));
|
||||
|
||||
titleElements = document.getElementsByTagName('title');
|
||||
println(`4a: ${titleElements.length}`)
|
||||
println(`4b: "${titleElements[0].innerText}"`);
|
||||
println(`4c: "${titleElements[1].innerText}"`);
|
||||
println(`4d: "${titleElements[2].innerText}"`);
|
||||
println(`5a: ${titleElements.length}`)
|
||||
println(`5b: "${titleElements[0].innerText}"`);
|
||||
println(`5c: "${titleElements[1].innerText}"`);
|
||||
println(`5d: "${titleElements[2].innerText}"`);
|
||||
|
||||
document.title = 'This is another title!';
|
||||
|
||||
titleElements = document.getElementsByTagName('title');
|
||||
println(`4e: ${titleElements.length}`)
|
||||
println(`4f: "${titleElements[0].innerText}"`);
|
||||
println(`4g: "${titleElements[1].innerText}"`);
|
||||
println(`4h: "${titleElements[2].innerText}"`);
|
||||
println(`5e: ${titleElements.length}`)
|
||||
println(`5f: "${titleElements[0].innerText}"`);
|
||||
println(`5g: "${titleElements[1].innerText}"`);
|
||||
println(`5h: "${titleElements[2].innerText}"`);
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue