Mark Preston wrote:
[color=blue]
> Randy Webb wrote:
>[color=green]
>> Mark Preston wrote:[/color][/color]
<--snip-->
[color=blue][color=green][color=darkred]
>>> "document.all" is for MSIE and "document.layers" is for Netscape 4.[/color]
>>
>>
>> No, and No.
>>[/color]
>
> Sorry, but "yes and yes".[/color]
The part of my quote that you snipped said this:
"All others are dead ducks"
And that is patently false, hence my "No, and No.", just as much as
saying "document.all is for MSIE" is patently false. To me that says its
for MSIE only, when its not. And for years the assumption by people that
didn't know any different was something along these lines:
if (document.all){
//its IE
}
And that is definitely wrong. While document.all was first implemented
by MSIE and document.layers in NS4, it does not make them for those
browsers alone. Maybe its just the way we interpret what we read *shrug*.
[color=blue][color=green]
>> Opera in Spoof mode honors one or the other. Firefox honors
>> document.all, and there is even a browser (I don't recall the name,
>> just recall Jim Ley mentioning it and Richard Cornford may be able to
>> name it) that supports *both* of those.
>>[/color]
>
> I know they do - but that is not what they were set up for. The
> "document.all" object was for IE and similarly "document.layers" was for
> Netscape 4. It is true, as you said, that other browsers do indeed *use*
> those forms, but that is not what they were set up for.[/color]
That is true, and I agree. But to say, now, that document.all is IE only
and document.layers is NS4 only is just plain wrong. Irrelevant of what
they were originally intended for.
[color=blue]
> It is always - almost - best to stick to standards and to avoid this
> sort of provider-specific code.[/color]
That depends on the standard and how well it's implemented. But then, I
am not a big fan of "standards" as I am a fan of whats reality.
Standards (with regards to ECMA) is how things *should* be, not how
things *are*. .toFixed() being probably the simplest and easiest to
screw up yet MS did it. So, do you stick to the "standard", or, do you
make it work around the limitation in the flaw of MS' implementation of it?
[color=blue]
> Granted, in the code referred to it would have been a lot more difficult
> to do since both were *extensions* to the standard that then existed so
> that additional features could be used in the specific browsers (and it
> is because they were extensions that offered additional features that
> they were "spoofed" in other browsers).[/color]
That code is *very* simple to make work in "modern" browsers using
document.getElementById, and quite trivially at that. Either way, it
doesn't change the simple reality that document.all is not IE4+ and
document.layers is not NS4 (exclusively).
--
Randy
comp.lang.javascript FAQ -
http://jibbering.com/faq