Bug 93784 - SVG textNode.getNumberOfChars reports 0 when it hasn't been attached to the document
Summary: SVG textNode.getNumberOfChars reports 0 when it hasn't been attached to the d...
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-12 13:27 PDT by Jon
Modified: 2022-07-13 13:17 PDT (History)
7 users (show)

See Also:


Attachments
Demonstrates incorrect value for textNode.getNumberOfChars() (1.19 KB, text/html)
2012-08-12 13:27 PDT, Jon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jon 2012-08-12 13:27:16 PDT
Created attachment 157908 [details]
Demonstrates incorrect value for textNode.getNumberOfChars()

To reproduce:
1. Dynamically create an SVG node, an SVG text node, and a text element
2. Add the text "hello" to the text element, and append the text element to the text node, and the text node to the svg node.
3. On the text node call getNumberOfChars()

What is the expected result?
5, the number of characters in "hello"

What happens instead?
0
Comment 1 Ahmad Saleem 2022-07-13 04:47:49 PDT
First the attached test case is in Quirks mode (although downloading and adding DOCTYPE also have same result across all browsers) and I am getting following in console across browsers:

*** Safari 15.5 on macOS 12.4 ****

Unappended Node. Expecting 5, but is actually: 0
Appended Node. Expecting 5, but is actually: 5

*** Chrome Canary 105 ****

Unappended Node. Expecting 5, but is actually: 0
Appended Node. Expecting 5, but is actually: 5

*** Firefox Nightly 104 ****

Unappended Node. Expecting 5, but is actually: 0
Appended Node. Expecting 5, but is actually: 5

Since it is consistent across all browsers, I think this can be considered as "RESOLVED WONTFIX" or "RESOLVED INVALID". Thanks!