[whatwg] getElementById

I see places that explicitly state that the same object is returned on some operations.  For example, the element.style has that clause.

I have not found in either html5 or the DOM documentation that is referenced an explicit statement to this effect for getElementById.

In FF 3.5, it seems to be true but it would be nice to know if it is or is not something that can be depended upon.

The other part to this that is not explicitly mentioned is if I attach a new javascript attribute to the object, is that legal?  Is it defined to work?  I have not found a statement one way or the other.

e.g.

foo = getElementById('foo');
foo.newAttr = true;

/* later */

foo = getElementById('foo');
if (foo.newAttr) {
  alert("happy happy joy joy");
}

Thank you,
Perry

Received on Monday, 10 May 2010 11:10:45 UTC