Re: Fix attribute types with spaces?

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 UTC