Re: Syntax to access div by ID.

On 12/10/2012 14:21, Patrick H. Lauke wrote:
> On 11/10/2012 13:05, Gautam Sathe wrote:
> [...]
>> <div id="testDiv">...</div>
>>
>> In a script section he was trying to set its display property to 'none'
>> and he had coded it like:
>>
>> testDiv.style.display = 'none';
> [...]
>
> I seem to remember this was something IE did first, and other browsers
> have adopted the behavior for compatibility reasons. It may actually now
> be standardised somewhere in HTML5/Living Standard.

And I'm told it may have issues in browsers like older versions of 
Firefox when the page is not in quirks mode...so worth testing.

Personally, I'd still use getElementById purely for clarity. It's not 
like those few bytes will make a whole lot of impact on code size, IMHO.

P
-- 
Patrick H. Lauke
______________________________________________________________
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]

www.splintered.co.uk | www.photographia.co.uk
http://redux.deviantart.com | http://flickr.com/photos/redux/
______________________________________________________________
twitter: @patrick_h_lauke | skype: patrick_h_lauke
______________________________________________________________

Received on Friday, 12 October 2012 13:24:37 UTC