From d6a5ddd3c0e146bfa45b54570cbb325a35137e1d Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 27 Jul 2022 21:14:16 +0100 Subject: LibWeb: Extract the ChildNode IDL mixin --- Userland/Libraries/LibWeb/DOM/CharacterData.idl | 10 ++-------- Userland/Libraries/LibWeb/DOM/ChildNode.idl | 13 +++++++++++++ Userland/Libraries/LibWeb/DOM/DocumentType.idl | 10 ++-------- Userland/Libraries/LibWeb/DOM/Element.idl | 11 +++-------- 4 files changed, 20 insertions(+), 24 deletions(-) create mode 100644 Userland/Libraries/LibWeb/DOM/ChildNode.idl (limited to 'Userland') diff --git a/Userland/Libraries/LibWeb/DOM/CharacterData.idl b/Userland/Libraries/LibWeb/DOM/CharacterData.idl index 856f9c16a3..a018f53c59 100644 --- a/Userland/Libraries/LibWeb/DOM/CharacterData.idl +++ b/Userland/Libraries/LibWeb/DOM/CharacterData.idl @@ -1,8 +1,9 @@ +#import #import #import +// https://dom.spec.whatwg.org/#characterdata interface CharacterData : Node { - [LegacyNullToEmptyString] attribute DOMString data; readonly attribute unsigned long length; @@ -14,11 +15,4 @@ interface CharacterData : Node { readonly attribute Element? nextElementSibling; readonly attribute Element? previousElementSibling; - - // FIXME: These should come from a ChildNode mixin - [CEReactions, Unscopable] undefined before((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined after((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes); - [CEReactions, Unscopable, ImplementedAs=remove_binding] undefined remove(); - }; diff --git a/Userland/Libraries/LibWeb/DOM/ChildNode.idl b/Userland/Libraries/LibWeb/DOM/ChildNode.idl new file mode 100644 index 0000000000..0cb5cefcd3 --- /dev/null +++ b/Userland/Libraries/LibWeb/DOM/ChildNode.idl @@ -0,0 +1,13 @@ +#import + +// https://dom.spec.whatwg.org/#childnode +interface mixin ChildNode { + [CEReactions, Unscopable] undefined before((Node or DOMString)... nodes); + [CEReactions, Unscopable] undefined after((Node or DOMString)... nodes); + [CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes); + [CEReactions, Unscopable, ImplementedAs=remove_binding] undefined remove(); +}; + +DocumentType includes ChildNode; +Element includes ChildNode; +CharacterData includes ChildNode; diff --git a/Userland/Libraries/LibWeb/DOM/DocumentType.idl b/Userland/Libraries/LibWeb/DOM/DocumentType.idl index bc1c622f5b..f2ea4fc0cb 100644 --- a/Userland/Libraries/LibWeb/DOM/DocumentType.idl +++ b/Userland/Libraries/LibWeb/DOM/DocumentType.idl @@ -1,15 +1,9 @@ +#import #import +// https://dom.spec.whatwg.org/#documenttype interface DocumentType : Node { - readonly attribute DOMString name; readonly attribute DOMString publicId; readonly attribute DOMString systemId; - - // FIXME: These should come from a ChildNode mixin - [CEReactions, Unscopable] undefined before((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined after((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes); - [CEReactions, Unscopable, ImplementedAs=remove_binding] undefined remove(); - }; diff --git a/Userland/Libraries/LibWeb/DOM/Element.idl b/Userland/Libraries/LibWeb/DOM/Element.idl index f86e2d4533..2f3ff86805 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.idl +++ b/Userland/Libraries/LibWeb/DOM/Element.idl @@ -1,11 +1,13 @@ +#import +#import #import #import #import #import #import #import -#import +// https://dom.spec.whatwg.org/#element interface Element : Node { readonly attribute DOMString? namespaceURI; readonly attribute DOMString? prefix; @@ -65,11 +67,4 @@ interface Element : Node { readonly attribute long clientLeft; readonly attribute long clientWidth; readonly attribute long clientHeight; - - // FIXME: These should come from a ChildNode mixin - [CEReactions, Unscopable] undefined before((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined after((Node or DOMString)... nodes); - [CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes); - [CEReactions, Unscopable, ImplementedAs=remove_binding] undefined remove(); - }; -- cgit v1.2.3