W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2005

Re: Fix attribute types with spaces?

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Sun, 18 Dec 2005 22:23:36 -0800
Message-ID: <c9e12660512182223pa933f67qa221d6f0d9fe61de@mail.gmail.com>
To: Kelly Miller <lightsolphoenix@gmail.com>
Cc: www-dom@w3.org

How about in Attr, new methods hasValue, addValue, and removeValue?

var classAttr = document.getElementById('test').getAttributeNode("class");
if(!classAttr.hasValue("fork"))
    classAttr.addValue("fork");


On 12/18/05, Kelly Miller <lightsolphoenix@gmail.com> wrote:
>
> I was just curious, is there possibly any fix for attributes that are
> supposed to be values separated by spaces (like class)?  I see a lot of
> code like this:
>
> document.getElementById('test').className += " newClass"
>
> And I wonder why elements like these couldn't be treated/returned as an
> array or something like that.  I personally don't think that treating
> these values as strings is such a great idea, since getting rid of them
> requires the use of regular expressions in most languages.
>
> --
> http://www.mozilla.org/products/firefox/ - Get Firefox!
> http://www.mozilla.org/products/thunderbird/ - Reclaim Your Inbox!
>
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>
>
>


--
http://dhtmlkitchen.com/
Received on Monday, 19 December 2005 06:25:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:58 GMT