diff --git a/parser/html/javasrc/ElementName.java b/parser/html/javasrc/ElementName.java
index 5748c3fbf46b..9ee2ad01520d 100644
--- a/parser/html/javasrc/ElementName.java
+++ b/parser/html/javasrc/ElementName.java
@@ -1166,7 +1166,7 @@ public static final ElementName MN = new ElementName("mn", "mn",
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
public static final ElementName KEYGEN = new ElementName("keygen", "keygen",
-// CPPONLY: NS_NewHTMLElement,
+// CPPONLY: NS_NewHTMLUnknownElement,
// CPPONLY: NS_NewSVGUnknownElement,
TreeBuilder.KEYGEN | SPECIAL);
public static final ElementName MAIN = new ElementName("main", "main",
diff --git a/parser/html/nsHtml5ElementName.cpp b/parser/html/nsHtml5ElementName.cpp
index 3e90b4e7ceab..93a6407d387c 100644
--- a/parser/html/nsHtml5ElementName.cpp
+++ b/parser/html/nsHtml5ElementName.cpp
@@ -787,7 +787,7 @@ void nsHtml5ElementName::initializeStatics() {
NS_NewSVGUnknownElement,
nsHtml5TreeBuilder::MI_MO_MN_MS_MTEXT | SCOPING_AS_MATHML);
ELT_KEYGEN = new nsHtml5ElementName(
- nsGkAtoms::keygen, nsGkAtoms::keygen, NS_NewHTMLElement,
+ nsGkAtoms::keygen, nsGkAtoms::keygen, NS_NewHTMLUnknownElement,
NS_NewSVGUnknownElement, nsHtml5TreeBuilder::KEYGEN | SPECIAL);
ELT_MAIN = new nsHtml5ElementName(
nsGkAtoms::main, nsGkAtoms::main, NS_NewHTMLElement,
diff --git a/testing/web-platform/meta/html/semantics/interfaces.html.ini b/testing/web-platform/meta/html/semantics/interfaces.html.ini
index 17f5b85ad571..faf9fd40e4d0 100644
--- a/testing/web-platform/meta/html/semantics/interfaces.html.ini
+++ b/testing/web-platform/meta/html/semantics/interfaces.html.ini
@@ -1,8 +1,10 @@
[interfaces.html]
prefs: [dom.dialog_element.enabled:true]
- [Interfaces for image]
+ [Interfaces for image: useNS]
expected: FAIL
+ bug: 1776081
- [Interfaces for IMAGE]
+ [Interfaces for IMAGE: createElement]
expected: FAIL
+ bug: 1776081
diff --git a/testing/web-platform/tests/html/semantics/interfaces.html b/testing/web-platform/tests/html/semantics/interfaces.html
index 9cb7f5eaef1c..dc7b600e0a0e 100644
--- a/testing/web-platform/tests/html/semantics/interfaces.html
+++ b/testing/web-platform/tests/html/semantics/interfaces.html
@@ -17,6 +17,8 @@ function do_test(local_name, iface, variant) {
if (variant === "useNS") {
// Use createElementNS here to preserve the case of local_name.
e = document.createElementNS("http://www.w3.org/1999/xhtml", local_name);
+ } else if (variant === "useParser") {
+ e = new DOMParser().parseFromString("<" + local_name + ">", "text/html").querySelector(local_name);
} else {
e = document.createElement(local_name);
}
@@ -31,17 +33,42 @@ function do_test(local_name, iface, variant) {
"Element " + local_name + " should implement Element.");
assert_true(e instanceof Node,
"Element " + local_name + " should implement Node.");
- }, "Interfaces for " + local_name);
+ }, "Interfaces for " + local_name + ": " + variant);
+}
+
+// Some elements have weird parser behavior / insertion modes and would be
+// skipped by the parser, so skip those.
+function should_do_parser_test(local_name) {
+ return ![
+ "foo-BAR",
+ "tbody",
+ "td",
+ "tfoot",
+ "th",
+ "thead",
+ "tr",
+ "å-bar",
+ "caption",
+ "col",
+ "colgroup",
+ "frame",
+ "image",
+ "frameset",
+ ].includes(local_name)
}
elements.forEach(function(a) {
do_test(a[0], a[1], "useNS");
+ if (should_do_parser_test(a[0])) {
+ do_test(a[0], a[1], "useParser");
+ }
+
// Only run the createElement variant if the input is all-lowercase, because createElement
// case-folds to lowercase. Custom elements are required to use all-lowercase to implement
// HTMLElement, otherwise they use HTMLUnknownElement per spec. Example: "foo-BAR".
if (a[0] === a[0].toLowerCase()) {
- do_test(a[0].toUpperCase(), a[1]);
+ do_test(a[0].toUpperCase(), a[1], "createElement");
}
})