Skip to content

Commit eeef370

Browse files
lpasAtkinsSJ
authored andcommitted
LibWeb: Check that elements are HTML elements in StackOfOpenElements
1 parent 08641c9 commit eeef370

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ void StackOfOpenElements::visit_edges(JS::Cell::Visitor& visitor)
2525
bool StackOfOpenElements::has_in_scope_impl(FlyString const& tag_name, Vector<FlyString> const& list, CheckMathAndSVG check_math_and_svg) const
2626
{
2727
for (auto const& element : m_elements.in_reverse()) {
28-
if (element->local_name() == tag_name)
28+
if (element->namespace_uri() == Namespace::HTML && element->local_name() == tag_name)
2929
return true;
30-
if (list.contains_slow(element->local_name()))
30+
if (element->namespace_uri() == Namespace::HTML && list.contains_slow(element->local_name()))
3131
return false;
3232
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))
3333
return false;
@@ -47,7 +47,7 @@ bool StackOfOpenElements::has_in_scope_impl(DOM::Element const& target_node, Vec
4747
for (auto& element : m_elements.in_reverse()) {
4848
if (element.ptr() == &target_node)
4949
return true;
50-
if (list.contains_slow(element->local_name()))
50+
if (element->namespace_uri() == Namespace::HTML && list.contains_slow(element->local_name()))
5151
return false;
5252
if (element->namespace_uri() == Namespace::SVG && element->local_name().is_one_of(SVG::TagNames::foreignObject, SVG::TagNames::desc, SVG::TagNames::title))
5353
return false;

Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_innerHTML_math.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ Harness status: OK
22

33
Found 8 tests
44

5-
4 Pass
6-
4 Fail
5+
8 Pass
76
Pass html5lib_innerHTML_math.html 0e7e70d0dcf0c26593203b36cac4fa7f6325613e
8-
Fail html5lib_innerHTML_math.html fa7d4a31838dbcc16bf73672f2f4486cca185673
9-
Fail html5lib_innerHTML_math.html d9d2e4c0e926a91f5e704846cdbc855e3cb21949
10-
Fail html5lib_innerHTML_math.html c04b203803f6b3bec3db65db16854e7e624d13ef
11-
Fail html5lib_innerHTML_math.html 4f95d47164955a6b163935fd8ac89ea200767330
7+
Pass html5lib_innerHTML_math.html fa7d4a31838dbcc16bf73672f2f4486cca185673
8+
Pass html5lib_innerHTML_math.html d9d2e4c0e926a91f5e704846cdbc855e3cb21949
9+
Pass html5lib_innerHTML_math.html c04b203803f6b3bec3db65db16854e7e624d13ef
10+
Pass html5lib_innerHTML_math.html 4f95d47164955a6b163935fd8ac89ea200767330
1211
Pass html5lib_innerHTML_math.html e942ee6666e1dc938aab10fc2374a2240806b439
1312
Pass html5lib_innerHTML_math.html 3537413f7f8166cb0c3a324fef8261be5628611d
1413
Pass html5lib_innerHTML_math.html c0186fb0fe26b48bcd82d58ebe0c90a423f26c28

Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_innerHTML_svg.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ Harness status: OK
22

33
Found 8 tests
44

5-
4 Pass
6-
4 Fail
5+
8 Pass
76
Pass html5lib_innerHTML_svg.html 9de06fc8491759163a4b2a4e17015c94cab31f13
8-
Fail html5lib_innerHTML_svg.html f4ffd3073d887daeb6b5d293547f3596a6bbe2b3
9-
Fail html5lib_innerHTML_svg.html 3abfcccd524311a4afcc0057334c8364616fd830
10-
Fail html5lib_innerHTML_svg.html 70fbdb7f147b21143966af3a9467f716cc314637
11-
Fail html5lib_innerHTML_svg.html 44994fe2eb6af6ad3511781f23bafcdd2d24692c
7+
Pass html5lib_innerHTML_svg.html f4ffd3073d887daeb6b5d293547f3596a6bbe2b3
8+
Pass html5lib_innerHTML_svg.html 3abfcccd524311a4afcc0057334c8364616fd830
9+
Pass html5lib_innerHTML_svg.html 70fbdb7f147b21143966af3a9467f716cc314637
10+
Pass html5lib_innerHTML_svg.html 44994fe2eb6af6ad3511781f23bafcdd2d24692c
1211
Pass html5lib_innerHTML_svg.html a148d278cbb59d5eadc1c6a5576c7887dcadb74e
1312
Pass html5lib_innerHTML_svg.html f1746231c89e495dc6b9d114d6d2f52876a1f5f5
1413
Pass html5lib_innerHTML_svg.html 1689d7c8f41a57eb15235d337028f3fe44764349

0 commit comments

Comments
 (0)