mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Only use lowercase attributes on toggle for HTML documents
This commit is contained in:
parent
89a536b57a
commit
e5206f5529
Notes:
sideshowbarker
2024-07-17 08:38:37 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/e5206f5529 Pull-request: https://github.com/SerenityOS/serenity/pull/24291
3 changed files with 20 additions and 2 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
<element xmlns="http://www.w3.org/1999/xhtml" Attribute="Value">Text</element>
|
||||||
|
<element xmlns="http://www.w3.org/1999/xhtml">Text</element>
|
||||||
|
<element xmlns="http://www.w3.org/1999/xhtml" Attribute="">Text</element>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
let xmlDoc = new DOMParser().parseFromString(
|
||||||
|
'<?xml version="1.0" encoding="UTF-8"?><root xmlns="http://www.w3.org/1999/xhtml"><element Attribute="Value">Text</element></root>',
|
||||||
|
'text/xml'
|
||||||
|
);
|
||||||
|
|
||||||
|
let element = xmlDoc.querySelector('element');
|
||||||
|
println(new XMLSerializer().serializeToString(element));
|
||||||
|
element.toggleAttribute('Attribute');
|
||||||
|
println(new XMLSerializer().serializeToString(element));
|
||||||
|
element.toggleAttribute('Attribute');
|
||||||
|
println(new XMLSerializer().serializeToString(element));
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -342,8 +342,7 @@ WebIDL::ExceptionOr<bool> Element::toggle_attribute(FlyString const& name, Optio
|
||||||
return WebIDL::InvalidCharacterError::create(realm(), "Attribute name must not be empty"_fly_string);
|
return WebIDL::InvalidCharacterError::create(realm(), "Attribute name must not be empty"_fly_string);
|
||||||
|
|
||||||
// 2. If this is in the HTML namespace and its node document is an HTML document, then set qualifiedName to qualifiedName in ASCII lowercase.
|
// 2. If this is in the HTML namespace and its node document is an HTML document, then set qualifiedName to qualifiedName in ASCII lowercase.
|
||||||
// FIXME: Handle the second condition, assume it is an HTML document for now.
|
bool insert_as_lowercase = namespace_uri() == Namespace::HTML && document().document_type() == Document::Type::HTML;
|
||||||
bool insert_as_lowercase = namespace_uri() == Namespace::HTML;
|
|
||||||
|
|
||||||
// 3. Let attribute be the first attribute in this’s attribute list whose qualified name is qualifiedName, and null otherwise.
|
// 3. Let attribute be the first attribute in this’s attribute list whose qualified name is qualifiedName, and null otherwise.
|
||||||
auto* attribute = m_attributes->get_attribute(name);
|
auto* attribute = m_attributes->get_attribute(name);
|
||||||
|
|
Loading…
Reference in a new issue