mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 23:15:08 +00:00
LibWeb: Add a FlyString version of Element::tag_name
Renaming the DeprecatedString version of this function to deprecated_tag_name. A FlyString is used here as we often need to perform equality checks here, and the HTMLParser already has tag_name as a FlyString. Remove a FIXME while we're at it - we were already following the spec there, and we still are :^)
This commit is contained in:
parent
9303e9e76f
commit
ff72436448
4 changed files with 9 additions and 8 deletions
|
@ -3531,7 +3531,7 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token)
|
|||
}
|
||||
|
||||
// -> An end tag whose tag name is "script", if the current node is an SVG script element
|
||||
if (token.is_end_tag() && current_node().namespace_() == Namespace::SVG && current_node().tag_name() == SVG::TagNames::script) {
|
||||
if (token.is_end_tag() && current_node().namespace_() == Namespace::SVG && current_node().tag_name().to_deprecated_fly_string() == SVG::TagNames::script) {
|
||||
ScriptEndTag:
|
||||
// Pop the current node off the stack of open elements.
|
||||
(void)m_stack_of_open_elements.pop();
|
||||
|
@ -3562,9 +3562,9 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token)
|
|||
if (token.is_end_tag()) {
|
||||
// 1. Initialize node to be the current node (the bottommost node of the stack).
|
||||
JS::GCPtr<DOM::Element> node = current_node();
|
||||
// FIXME: Not sure if this is the correct to_lowercase, as the specification says "to ASCII lowercase"
|
||||
|
||||
// 2. If node's tag name, converted to ASCII lowercase, is not the same as the tag name of the token, then this is a parse error.
|
||||
if (node->tag_name().to_lowercase() != token.tag_name().to_deprecated_fly_string())
|
||||
if (node->tag_name().equals_ignoring_ascii_case(token.tag_name()))
|
||||
log_parse_error();
|
||||
|
||||
// 3. Loop: If node is the topmost element in the stack of open elements, then return. (fragment case)
|
||||
|
@ -3573,10 +3573,10 @@ void HTMLParser::process_using_the_rules_for_foreign_content(HTMLToken& token)
|
|||
VERIFY(m_parsing_fragment);
|
||||
return;
|
||||
}
|
||||
// FIXME: See the above FIXME
|
||||
|
||||
// 4. If node's tag name, converted to ASCII lowercase, is the same as the tag name of the token, pop elements from the stack
|
||||
// of open elements until node has been popped from the stack, and then return.
|
||||
if (node->tag_name().to_lowercase() == token.tag_name().to_deprecated_fly_string()) {
|
||||
if (node->tag_name().equals_ignoring_ascii_case(token.tag_name())) {
|
||||
while (¤t_node() != node.ptr())
|
||||
(void)m_stack_of_open_elements.pop();
|
||||
(void)m_stack_of_open_elements.pop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue