Kangax,
I could extend a bit the testing to ensure type is "unknown" but I
believe it is unfeasible since at some point that property will be
"number" in IE.

That property can be tested for "unknown" only in rare and specific
occasions, in that case it should be done before anything else, after
DOM has finished loading that property will be a number, in case of
static pages, in case of dynamic pages that will depend on the headers
sent by the server...(no-cache, pragma et all).

This is the reason I kept testing for just !== "undefined".

If we are presuming that somebody with some bad code can fold our
checks, yes that will always be true, both if we use sniffing,
inference or feature testing. Really, people could also overwrite the
createElement, or prototype the HTMLIFrameElement to open a window
instead but we should draw a line about what is necessary and
consistent.

Why would somebody use the "fileSize" property if the 3/4 of the
browsers have this property natively....and why would they want to add
that to FF / Opera / Webkit only and not to Internet Explorer, I
believe we are crossing the border of usefulness here...

As I said, I reiterate that feature testing is the best method, nearly
in all cases, both inference and sniffing have their places in the
game.

Diego


On 13 Gen, 18:00, kangax <kan...@gmail.com> wrote:
> On Jan 13, 10:17 am, Diego Perini <diego.per...@gmail.com> wrote:
>
> > Kanagax,
> > agree with you about "using (or not) frames" being irrelevant if the
> > is objective is met. I was talking about reducing a bit the code size
> > were possible, feature testing is more costly in byte size.
>
> > Please tell me how a 3d party is going to create problem with those
> > testing I am really interested into improve them if possible.
>
> > You see, the "document.fileSize" property in IE is read-only, and it
> > is of a type the user cannot create himself that I know, but would be
> > very interested in how the user could create a variable of type
> > "unknown", especially how to I create an "unknown" variable in FF /
> > Opera / Webkit / Konqueror or mobile web browsers ???
>
> Your snippet didn't test for typeof "unknown", but rather for  "!=
> 'undefined'". Sorry if I missed something. If a 3rd party script
> defines `document.fileSize` in non-IE browser, your proposed `IE`
> boolean will have a false positive:
>
> // run this in Firefox
> document.fileSize = 1024;
> IE = typeof document.fileSize != 'undefined';
> IE; // true
>
> [...]
>
> --
> kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to