LibWeb: Check that elements are HTML elements in StackOfOpenElements

This commit is contained in:
Lorenz A 2025-10-19 01:39:19 +02:00 committed by Sam Atkins
parent 08641c9e15
commit eeef370902
3 changed files with 13 additions and 15 deletions

View File

@ -25,9 +25,9 @@ void StackOfOpenElements::visit_edges(JS::Cell::Visitor& visitor)
bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const& list, CheckMathAndSVG check_math_and_svg) const
{
for (auto const& element : m_elements.in_reverse()) {
if (element->local_name() == tag_name)
if (element->namespace_uri() == Namespace::HTML && element->local_name() == tag_name)
return true;
if (list.contains_slow(element->local_name()))
if (element->namespace_uri() == Namespace::HTML && list.contains_slow(element->local_name()))
return false;
if (check_math_and_svg == CheckMathAndSVG::Yes && element->namespace_uri() == Namespace::SVG && element->local_name().is_one_of(SVG::TagNames::foreignObject, SVG::TagNames::desc, SVG::TagNames::title))
return false;
@ -47,7 +47,7 @@ bool StackOfOpenElements::has_in_scope_impl(DOM::Element const& target_node, Vec
for (auto& element : m_elements.in_reverse()) {
if (element.ptr() == &target_node)
return true;
if (list.contains_slow(element->local_name()))
if (element->namespace_uri() == Namespace::HTML && list.contains_slow(element->local_name()))
return false;
if (element->namespace_uri() == Namespace::SVG && element->local_name().is_one_of(SVG::TagNames::foreignObject, SVG::TagNames::desc, SVG::TagNames::title))
return false;

View File

@ -2,13 +2,12 @@ Harness status: OK
Found 8 tests
4 Pass
4 Fail
8 Pass
Pass html5lib_innerHTML_math.html 0e7e70d0dcf0c26593203b36cac4fa7f6325613e
Fail html5lib_innerHTML_math.html fa7d4a31838dbcc16bf73672f2f4486cca185673
Fail html5lib_innerHTML_math.html d9d2e4c0e926a91f5e704846cdbc855e3cb21949
Fail html5lib_innerHTML_math.html c04b203803f6b3bec3db65db16854e7e624d13ef
Fail html5lib_innerHTML_math.html 4f95d47164955a6b163935fd8ac89ea200767330
Pass html5lib_innerHTML_math.html fa7d4a31838dbcc16bf73672f2f4486cca185673
Pass html5lib_innerHTML_math.html d9d2e4c0e926a91f5e704846cdbc855e3cb21949
Pass html5lib_innerHTML_math.html c04b203803f6b3bec3db65db16854e7e624d13ef
Pass html5lib_innerHTML_math.html 4f95d47164955a6b163935fd8ac89ea200767330
Pass html5lib_innerHTML_math.html e942ee6666e1dc938aab10fc2374a2240806b439
Pass html5lib_innerHTML_math.html 3537413f7f8166cb0c3a324fef8261be5628611d
Pass html5lib_innerHTML_math.html c0186fb0fe26b48bcd82d58ebe0c90a423f26c28

View File

@ -2,13 +2,12 @@ Harness status: OK
Found 8 tests
4 Pass
4 Fail
8 Pass
Pass html5lib_innerHTML_svg.html 9de06fc8491759163a4b2a4e17015c94cab31f13
Fail html5lib_innerHTML_svg.html f4ffd3073d887daeb6b5d293547f3596a6bbe2b3
Fail html5lib_innerHTML_svg.html 3abfcccd524311a4afcc0057334c8364616fd830
Fail html5lib_innerHTML_svg.html 70fbdb7f147b21143966af3a9467f716cc314637
Fail html5lib_innerHTML_svg.html 44994fe2eb6af6ad3511781f23bafcdd2d24692c
Pass html5lib_innerHTML_svg.html f4ffd3073d887daeb6b5d293547f3596a6bbe2b3
Pass html5lib_innerHTML_svg.html 3abfcccd524311a4afcc0057334c8364616fd830
Pass html5lib_innerHTML_svg.html 70fbdb7f147b21143966af3a9467f716cc314637
Pass html5lib_innerHTML_svg.html 44994fe2eb6af6ad3511781f23bafcdd2d24692c
Pass html5lib_innerHTML_svg.html a148d278cbb59d5eadc1c6a5576c7887dcadb74e
Pass html5lib_innerHTML_svg.html f1746231c89e495dc6b9d114d6d2f52876a1f5f5
Pass html5lib_innerHTML_svg.html 1689d7c8f41a57eb15235d337028f3fe44764349