mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibWeb: Use HTML-uppercased qualified name for the Element node name
For regular elements, this is just the qualified name. However, for HTML elements in HTML documents, it is the qualified name uppercased. This is used by jQuery to determine the document is an HTML document. Not having this made jQuery assume the document was XML, causing weird behaviour. To do this, an internal string of qualified name is created. This is to prevent constantly regenerating it. This is allowed by the spec. This is the same for the HTML-uppercased qualified name.
This commit is contained in:
parent
7c6c7ca542
commit
19731fc14c
3 changed files with 34 additions and 1 deletions
|
@ -34,6 +34,7 @@ Element::Element(Document& document, QualifiedName qualified_name)
|
|||
: ParentNode(document, NodeType::ELEMENT_NODE)
|
||||
, m_qualified_name(move(qualified_name))
|
||||
{
|
||||
make_html_uppercased_qualified_name();
|
||||
}
|
||||
|
||||
Element::~Element()
|
||||
|
@ -359,4 +360,14 @@ NonnullRefPtr<CSS::CSSStyleDeclaration> Element::style_for_bindings()
|
|||
return *m_inline_style;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#element-html-uppercased-qualified-name
|
||||
void Element::make_html_uppercased_qualified_name()
|
||||
{
|
||||
// This is allowed by the spec: "User agents could optimize qualified name and HTML-uppercased qualified name by storing them in internal slots."
|
||||
if (namespace_() == Namespace::HTML /* FIXME: and its node document is an HTML document */)
|
||||
m_html_uppercased_qualified_name = qualified_name().to_uppercase();
|
||||
else
|
||||
m_html_uppercased_qualified_name = qualified_name();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue