On Jan 13, 3:23 pm, Diego Perini <diego.per...@gmail.com> wrote:
> 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.

Perhaps. Although, IE8 still returns "unknown" for `typeof` of certain
objects and it seems unlikely that they change internal representation
anytime soon.

>
> 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.

True. We *do* need to draw a line at some point, but wouldn't you want
to use a test that is tolerant to false positives produced by 3rd
party scripts? For example, no 3rd party script can spoof `typeof`
result to return "unknown" instead of, say, "object". Javascript/DOM
simply do not allow such level of control. The same is true for
conditional compilation syntax extension - i.e. /*...@cc_on */ - which
every version of IE supports till this day and is very unlikely to
drop.

Using such tests still doesn't "save" you from changes in later
versions of browsers; If IE starts being more standard-compliant, the
test will return false positives. It nevertheless prevents you from
3rd party collisions (and so gives you one less potential annoyance to
worry about).

>
> 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

You'll be surprised ; )

> that to FF / Opera / Webkit only and not to Internet Explorer, I
> believe we are crossing the border of usefulness here...

I don't mean to stress this subject any longer. I simply remember how
assumptions like this lead to problems in the future (when someone
implements something that you would never expect - e.g.
`document.fileSize` - for whatever reasons the author has).

[...]

--
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