1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

LibWeb: Make Node.textContent more spec compliant

The current implementation felt a bit ad-hoc and notably allowed
textContent to operate on all node types. It also only returned the
child text content of the Node instead of the descendant text content.
This commit is contained in:
Luke Wilde 2021-09-06 00:21:59 +01:00 committed by Andreas Kling
parent d36838d050
commit 5e61382849
4 changed files with 40 additions and 14 deletions

View file

@ -14,7 +14,11 @@ interface Node : EventTarget {
readonly attribute Element? parentElement;
readonly attribute boolean isConnected;
readonly attribute Document? ownerDocument;
attribute DOMString textContent;
// FIXME: [LegacyNullToEmptyString] is not allowed on nullable types as per the Web IDL spec.
// However, we only apply it to setters, so this works as a stop gap.
// Replace this with something like a special cased [LegacyNullToEmptyString].
[LegacyNullToEmptyString] attribute DOMString? textContent;
Node appendChild(Node node);
[ImplementedAs=pre_insert] Node insertBefore(Node node, Node? child);