LibWeb: Make offset for HTML style and script elements one after

This commit is contained in:
Chase Knowlden 2025-06-19 17:56:57 -04:00 committed by Sam Atkins
parent ffd5503dcb
commit ac22e71184
Notes: github-actions[bot] 2025-07-03 09:12:30 +00:00

View file

@ -68,11 +68,13 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
if (token->tag_name() == "script"sv) {
tokenizer.switch_to(HTMLTokenizer::State::ScriptData);
state = State::Javascript;
substring_start_position = { token->end_position().line, token->end_position().column };
// The end position points to the '>' character, but we need the position after it
substring_start_position = { token->end_position().line, token->end_position().column + 1 };
} else if (token->tag_name() == "style"sv) {
tokenizer.switch_to(HTMLTokenizer::State::RAWTEXT);
state = State::CSS;
substring_start_position = { token->end_position().line, token->end_position().column };
// The end position points to the '>' character, but we need the position after it
substring_start_position = { token->end_position().line, token->end_position().column + 1 };
}
} else if (token->is_end_tag()) {
if (token->tag_name().is_one_of("script"sv, "style"sv)) {