mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Make HTML parser "current node" APIs return nullable pointer
It's actually possible for there to be no adjusted current node, when the stack of open elements is empty. This was covered by one of the WPT parsing tests.
This commit is contained in:
parent
ebce483278
commit
64747c0397
Notes:
github-actions[bot]
2024-11-03 19:33:21 +00:00
Author: https://github.com/awesomekling
Commit: 64747c0397
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2142
5 changed files with 117 additions and 78 deletions
|
@ -433,7 +433,9 @@ _StartOfFunction:
|
|||
if (consume_next_if_match("[CDATA["sv)) {
|
||||
// We keep the parser optional so that syntax highlighting can be lexer-only.
|
||||
// The parser registers itself with the lexer it creates.
|
||||
if (m_parser != nullptr && m_parser->adjusted_current_node().namespace_uri() != Namespace::HTML) {
|
||||
if (m_parser != nullptr
|
||||
&& m_parser->adjusted_current_node()
|
||||
&& m_parser->adjusted_current_node()->namespace_uri() != Namespace::HTML) {
|
||||
SWITCH_TO(CDATASection);
|
||||
} else {
|
||||
create_new_token(HTMLToken::Type::Comment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue