Re: Dynamic select lists using optgroups again - without frameworks
- From: Thomas 'PointedEars' Lahn <PointedEars@xxxxxx>
- Date: Mon, 21 Jan 2008 00:47:16 +0100
RobG wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
RobG wrote:
It has been mentioned here a number of times that you can achieve theHowever, the functionality of this approach is based on mere assumption,
same effect as a "dom ready" function by inserting all your scripts
just before the closing </body> tab, then calling your initialising
function at the bottom of the last script element, or as the only code
in the last script element.
The DOM will be ready and you don't need to use window.onload (or
document.body or whatever) or DOM ready and it has the pleasant side
effect of loading the page faster.
much in contrast to the intrinsic `onload' event handler attribute.
Using onload is also based on the "mere assumption" that the UA
supports onload. If you feature detect for onload and find it's not
supported, what then?
You are confusing the proprietary event handler property, and the
standardized intrinsic event handler attribute as specified in HTML 4.01 and
universally supported long before that. (It is easy and appropriate to say
that because for Web developers there were only two user agents to consider
at the time the feature was introduced, Netscape Navigator and Microsoft
Internet Explorer; in order to keep up with the competition, their features
were readily implemented by other vendors, including the `onload' attribute.
Which eventually led to its inclusion in HTML 4 as being an apparently
universally supported feature that therefore deserved to be standardized.)
I recommended using the latter one.
I imagine that scenarios is about as common as finding that the DOM
isn't ready when the very last element is parsed.
Apples, oranges. There is exactly *nothing* in any public specification
that says that the document tree would be fully accessible with all
specified properties and methods before the `load' event of the document
occurs. Your suggestion is (naturally) merely based on observation in a
subset of user agents, and the jump to the conclusion that therefore it must
be so in all user agents. That, however, is a well-known logical fallacy.
Which is why the code that follows that conclusion deserves to be called
error-prone.
PointedEars
.
- Follow-Ups:
- Re: Dynamic select lists using optgroups again - without frameworks
- From: Thomas 'PointedEars' Lahn
- Re: Dynamic select lists using optgroups again - without frameworks
- References:
- Dynamic select lists using optgroups again - without frameworks
- From: Pascal Ehlert
- Re: Dynamic select lists using optgroups again - without frameworks
- From: Pascal Ehlert
- Re: Dynamic select lists using optgroups again - without frameworks
- From: Thomas 'PointedEars' Lahn
- Re: Dynamic select lists using optgroups again - without frameworks
- From: Pascal Ehlert
- Re: Dynamic select lists using optgroups again - without frameworks
- From: RobG
- Re: Dynamic select lists using optgroups again - without frameworks
- From: Thomas 'PointedEars' Lahn
- Re: Dynamic select lists using optgroups again - without frameworks
- From: RobG
- Dynamic select lists using optgroups again - without frameworks
- Prev by Date: Re: If you had JavaScript running server-side...?
- Next by Date: Re: Dynamic select lists using optgroups again - without frameworks
- Previous by thread: Re: Dynamic select lists using optgroups again - without frameworks
- Next by thread: Re: Dynamic select lists using optgroups again - without frameworks
- Index(es):
Relevant Pages
|