- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 3 Aug 2010 21:56:36 +0000 (UTC)
On Mon, 10 May 2010, Perry Smith wrote: > > 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. getElementById() is a DOM Core method, so not defined by the HTML spec. However, the DOM spec says it returns "the Element", so that seems to require that the same Element object representing the element be returned. In practice there is always only one object per element anyway. > 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"); > } This would be defined by WebIDL. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 3 August 2010 14:56:36 UTC