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: Calculate length for all
CharacterData
type nodes correctly
We now ensure that `Node::is_character_data()` returns true for all nodes of type character data. Previously, calling `Node::length()` on `CDataSection` or `ProcessingInstruction` nodes would return an incorrect value.
- Loading branch information
Showing
3 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
Tests/LibWeb/Text/expected/DOM/Range-containing-CDATASection.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 @@ | ||
range start offset: 0, end offset: 3 |
11 changes: 11 additions & 0 deletions
11
Tests/LibWeb/Text/input/DOM/Range-containing-CDATASection.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,11 @@ | ||
<script src="../include.js"></script> | ||
<script> | ||
test(() => { | ||
const xmlDocument = new DOMParser().parseFromString(`<xml></xml>`, "application/xml"); | ||
const cdata = xmlDocument.createCDATASection("DATA"); | ||
const range = xmlDocument.createRange(); | ||
range.setStart(cdata, 0); | ||
range.setEnd(cdata, 3); | ||
println(`range start offset: ${range.startOffset}, end offset: ${range.endOffset}`); | ||
}); | ||
</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