[thelist] Workaround for setAttribute bug in IE7?

Lee kowalkowski lee.kowalkowski at googlemail.com
Wed Dec 13 10:58:53 CST 2006


On 13/12/06, Matt Warden <mwarden at gmail.com> wrote:
> On 12/12/06, Lee kowalkowski <lee.kowalkowski at googlemail.com> wrote:
> Yes, it creates an *object property* in JavaScript. If you read my
> entire message (not just the portion you replied to), you'll see I'm
> saying that having an assignment with the side effect of creating DOM
> nodes is a really dumb idea.

I understood, and I'm saying in a JavaScript binding to a
browser-supplied object, the difference between attribute and property
should ideally be transparent as a matter of utmost convenience.

My emphasis is the fact that the JS and DOM are bound, therefore if it
*didn't* create the attribute - *that* would be a side-effect.

> Really dumb idea: removing assignment to object property deletes DOM
> attribute node

I didn't actually say that because you can't remove assignments to DOM
object properties without using removeAttribute (In IE).  The
assignment operator is no way to go about removing objects or
properties.

If anything should do the removing of attributes in the JS binding it
should be the delete operator, but unfortunately IE's browser DOM
doesn't support that action, although other browsers do.

What I said was assigning a property to null or undefined doesn't
remove the property itself, just changes its value.  It could even
create the property, if it doesn't exist, as stated in ECMA-262
section 8.6.2.2.  So why shouldn't I expect it to create a DOM
attribute?

-- 
Lee



More information about the thelist mailing list