forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
5 changed files
with
54 additions
and
62 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
Tests/LibWeb/Text/expected/css/attribute-selector-case-sensitivity.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The accept attribute is matched case insensitively in HTML documents true | ||
The accept attribute is matched case insensitively in XML documents false | ||
The accesskey attribute is matched case insensitively in HTML documents false | ||
The accesskey attribute is matched case insensitively in XML documents false |
18 changes: 18 additions & 0 deletions
18
Tests/LibWeb/Text/input/css/attribute-selector-case-sensitivity.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters