mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Match attribute selectors case insensitively in XML documents
The values of attribute selectors are now compared case insensitively by default if the attribute's document is not a HTML document, or the element is not in the HTML namespace.
This commit is contained in:
committed by
Andreas Kling
parent
c422518792
commit
00f03f3e90
Notes:
github-actions[bot]
2024-08-19 07:04:16 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/00f03f3e900 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1116
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const elementName = "a";
|
||||
const attributeNames = ["accept", "accesskey"];
|
||||
for (const attributeName of attributeNames) {
|
||||
const htmlElement = document.createElement(elementName);
|
||||
htmlElement.setAttribute(attributeName, "TeSt");
|
||||
println(`The ${attributeName} attribute is matched case insensitively in HTML documents ${htmlElement.matches(`[${attributeName}^=test]`)}`);
|
||||
|
||||
const xmlDocument = new Document();
|
||||
const xmlElement = xmlDocument.createElementNS("http://www.w3.org/1999/xhtml", elementName);
|
||||
xmlElement.setAttribute(attributeName, "TeSt");
|
||||
println(`The ${attributeName} attribute is matched case insensitively in XML documents ${xmlElement.matches(`[${attributeName}^=test]`)}`);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user