RE: why does <text/> have no firstChild with value ""

Jonathan,

There is a very real, and potentially important semantic difference between the following concepts:

Empty: <text></text>
Null: <text/>
Nonexistant: ...

Your specific application may not need to understand the difference between the 3 cases - it's enough to consider the Null and Nonexistant cases the same as Empty - however, this is not universally true and it would be irresponsible to disallow a distinction in the spec.

The best advice I have for you as an implementer is to abstract a "getText()" method, that understands how to test for the different cases and return a normalized value, which in your case sounds like "" would work great.

Good luck,
 ~ Paul

-----Original Message-----
From: www-svg-request@w3.org [mailto:www-svg-request@w3.org] On Behalf Of Jonathan Chetwynd
Sent: Sunday, October 03, 2010 9:16 AM
To: www-svg
Subject: why does <text/> have no firstChild with value ""

why does <text/> have no firstChild with value ""

Can someone please point me to an explanation why the authors  
inclusion of an empty text element does not generate a firstChild with  
value the empty string?
my issue is that the current methodology requires additional coding  
and complication for the author, and little or no benefit to the UA,  
afaict.

regards

Jonathan Chetwynd


A couple of kindly respondents provided excellent responses offline to  
my original post:

Re: SVG 1.1 Does no text exist in the DOM? or why no eggs?

but I hope this version may be a little clearer.

Received on Monday, 4 October 2010 15:14:10 UTC