From 910ff8b6944dd57d20b7f2dd8330265345095d67 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Tue, 24 Dec 2024 02:44:05 +1300 Subject: [PATCH] LibWeb/HTML: Consider all-named elements instead of Leaving only the unimplemented legacy [[Call]] override funkiness of HTMLAllCollection left not passing in the WPT tests. --- Libraries/LibWeb/HTML/HTMLAllCollection.cpp | 4 +- .../collections/htmlallcollection.txt | 47 +++ .../collections/htmlallcollection.html | 334 ++++++++++++++++++ 3 files changed, 383 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html diff --git a/Libraries/LibWeb/HTML/HTMLAllCollection.cpp b/Libraries/LibWeb/HTML/HTMLAllCollection.cpp index 7ddcc05684b..5201a3d0492 100644 --- a/Libraries/LibWeb/HTML/HTMLAllCollection.cpp +++ b/Libraries/LibWeb/HTML/HTMLAllCollection.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +68,7 @@ void HTMLAllCollection::visit_edges(Cell::Visitor& visitor) static bool is_all_named_element(DOM::Element const& element) { // The following elements are "all"-named elements: a, button, embed, form, frame, frameset, iframe, img, input, map, meta, object, select, and textarea - return is(element) + return is(element) || is(element) || is(element) || is(element) diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.txt b/Tests/LibWeb/Text/expected/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.txt new file mode 100644 index 00000000000..541cea8c618 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.txt @@ -0,0 +1,47 @@ +Harness status: OK + +Found 41 tests + +30 Pass +11 Fail +Pass document.all is an HTMLAllCollection +Pass length attribute +Pass indexed property getter +Pass indexed property getter out of range +Pass named property getter +Pass named property getter with dot syntax +Pass named property getter with invalid name +Pass named property getter returning collection +Pass named property getter with "array index property name" +Pass named property getter with invalid "array index property name" +Pass named property getter with undefined +Pass named property getter with null +Pass namedItem method +Pass namedItem method with invalid name +Pass namedItem method returning collection +Pass namedItem method with "array index property name" +Pass namedItem method with invalid "array index property name" +Pass namedItem method with undefined +Pass namedItem method with null +Pass namedItem method with no argument +Fail legacy caller +Fail legacy caller with invalid name +Fail legacy caller returning collection +Fail legacy caller with "array index property name" +Fail legacy caller with "array index property name" as number +Fail legacy caller with invalid "array index property name" +Fail legacy caller with undefined +Fail legacy caller with null +Fail legacy caller with no argument +Pass legacy caller is not a constructor +Fail legacy caller with arbitrary this value +Pass item method +Pass item method with invalid name +Pass item method returning collection +Pass item method with "array index property name" +Pass item method with "array index property name" as number +Pass item method with invalid "array index property name" +Pass item method with undefined +Pass item method with null +Pass item method with no argument +Fail collections are new live HTMLCollection instances \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html b/Tests/LibWeb/Text/input/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html new file mode 100644 index 00000000000..17b2dad5757 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html @@ -0,0 +1,334 @@ + + + +HTMLAllCollection Tests + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ + +