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: Make
document.createElementNS()
case-sensitive
Previously, when creating a HTML element with `document.createElementNS()` we would convert the given local name to lowercase before deciding which element type to return. We now no longer perform this lower case conversion, so if an uppercase local name is provided, an element of type `HTMLUnknownElement` will be returned. This aligns our implementation with the specification.
- Loading branch information
Showing
3 changed files
with
91 additions
and
71 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
Tests/LibWeb/Text/expected/DOM/Document-createElementNS-uppercase.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 @@ | ||
document.createElementNS(HTMLNS, "DIV") is instance of HTMLUnknownElement: true | ||
document.createElementNS(HTMLNS, "div") is instance of HTMLDivElement: true | ||
document.createElement("DIV") is instance of HTMLDivElement: true | ||
document.createElement("div") is instance of HTMLDivElement: true |
16 changes: 16 additions & 0 deletions
16
Tests/LibWeb/Text/input/DOM/Document-createElementNS-uppercase.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,16 @@ | ||
<!DOCTYPE html> | ||
<script src="../include.js"></script> | ||
<script> | ||
test(() => { | ||
const HTMLNS = "http://www.w3.org/1999/xhtml"; | ||
const uppercaseElement = document.createElementNS(HTMLNS, "DIV"); | ||
println(`document.createElementNS(HTMLNS, "DIV") is instance of HTMLUnknownElement: ${uppercaseElement instanceof HTMLUnknownElement}`); | ||
const lowercaseElement = document.createElementNS(HTMLNS, "div"); | ||
println(`document.createElementNS(HTMLNS, "div") is instance of HTMLDivElement: ${lowercaseElement instanceof HTMLDivElement}`); | ||
|
||
const uppercaseElement2 = document.createElement("DIV"); | ||
println(`document.createElement("DIV") is instance of HTMLDivElement: ${uppercaseElement2 instanceof HTMLDivElement}`); | ||
const lowercaseElement2 = document.createElement( "div"); | ||
println(`document.createElement("div") is instance of HTMLDivElement: ${lowercaseElement2 instanceof HTMLDivElement}`); | ||
}); | ||
</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