W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: Text selector [was Re: breaking overflow]

From: Brad Kemper <brad.kemper@gmail.com>
Date: Mon, 4 Jan 2010 09:04:53 -0800
Cc: Boris Zbarsky <bzbarsky@MIT.EDU>, www-style list <www-style@w3.org>
Message-Id: <F47FF3B8-4DDF-4AD3-A52F-4A3DADB05101@gmail.com>
To: James Hopkins <james@idreamincode.co.uk>

On Jan 4, 2010, at 4:15 AM, James Hopkins wrote:

> My thoughts on the following scenarios:-
> 
>> Simple example #1:
>> 
>> <!DOCTYPE html>
>> <body>
>> <script>
>> document.body.appendChild(document.createTextNode("ba"));
>> document.body.appendChild(document.createTextNode("r"));
>> </script>
> 
> The authors intention was to create two separate textnodes, thus they should be treated separately.

[...]
>> Example #6, which depends on exact behavior still being hammered out in the HTML5 spec:
>> 
>> <!DOCTYPE html>
>> <body><script>
>> document.write("ba"); document.write("r");
>> </script>
> 
> They're written as two separate entities, so should be treated as such.

I don't think you can assume the author's intention, and don't think they are necessary written separate for reasons other than coding convenience. Consider the following, for instance:

document.body.appendChild(document.createTextNode("bar"));
if(moreThanOneBar) {
  document.body.appendChild(document.createTextNode("s"));
}

or 

document.write("baz");
if(moreThanOneBaz) {
  document.write("es");
}



Received on Monday, 4 January 2010 17:05:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:23 GMT