mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Insert title as first child on setting title of svg document
Before, the new title element got appended instead of prepended, as nullptr was passed as the "child" argument to the insert_before() function. This change makes two WPT tests pass in: http://wpt.live/html/dom/documents/dom-tree-accessors/document.title-09.html
This commit is contained in:
parent
910f9c2c09
commit
3ff6137121
Notes:
github-actions[bot]
2024-10-14 05:14:48 +00:00
Author: https://github.com/ronak69 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3ff61371213 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1773
3 changed files with 14 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
title == title
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
||||
var doc = document.implementation.createDocument(SVG_NAMESPACE, "svg", null);
|
||||
var child = doc.createElementNS(SVG_NAMESPACE, "x-child");
|
||||
doc.documentElement.appendChild(child);
|
||||
doc.title = "foo";
|
||||
println(`title == ${doc.documentElement.firstChild.tagName}`);
|
||||
});
|
||||
</script>
|
|
@ -923,7 +923,7 @@ WebIDL::ExceptionOr<void> Document::set_title(String const& title)
|
|||
element = TRY(DOM::create_element(*this, HTML::TagNames::title, Namespace::SVG));
|
||||
|
||||
// 2. Insert element as the first child of the document element.
|
||||
document_element->insert_before(*element, nullptr);
|
||||
document_element->insert_before(*element, document_element->first_child());
|
||||
}
|
||||
|
||||
// 3. String replace all with the given value within element.
|
||||
|
|
Loading…
Reference in a new issue