W3C home > Mailing lists > Public > www-svg@w3.org > October 2010

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

From: Paul Williams <pwilliams@infotrustgroup.com>
Date: Mon, 4 Oct 2010 08:13:33 -0700
To: Jonathan Chetwynd <j.chetwynd@btinternet.com>, www-svg <www-svg@w3.org>
Message-ID: <8FD3C07789EF874BB97A16748B1B37039A3A07ABF7@irvmail.infotrustgroup.com>
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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:46 GMT