On Sep 14, 6:11 pm, Andrea Giammarchi <andrea.giammar...@gmail.com>
wrote:
> Kean I do not get with who you are talking, is it me? I perfectly know kangx
> post, I knew before (old codes in devpro) , and I use a strategy not even
> mentioned in kangax post where the last fallback is always the IE one to
> avoid redundancy and any kind of problem ... e.g.
You must be joking :) How is this to "avoid any kind of problem" when
you base your code on unspecified, non-standard and generally known to
be quirky behavior? Function declarations in blocks are not even
syntactically valid (!) as per ES3. It's just that browsers generally
ignore this for compatibility reasons and parse things in some
proprietary way (trying to guess what it is that you are trying to
do). Are you OK with this browser's guess game, having no idea how
another unknown environment will decide to interpret your script? I'm
not, and do recommend to avoid this.
And if you're still not convinced (I wouldn't be surprised, it's hard
to convince you :)), here's a quote from ES5:
<quote>
NOTE
Several widely used implementations of ECMAScript are known to support
the use of FunctionDeclaration as a Statement. However there are
significant and irreconcilable variations among the implementations in
the semantics applied to such FunctionDeclarations. Because of these
irreconcilable difference, the use of a FunctionDeclaration as a
Statement results in code that is not reliably portable among
implementations. It is recommended that ECMAScript implementations
either disallow this usage of FunctionDeclaration or issue a warning
when such a usage is encountered. Future editions of ECMAScript may
define alternative portable means for declaring functions in a
Statement context.
</quote>
It's up to end developer to choose which way to go, of course.
[...]
--
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
-~----------~----~----~----~------~----~------~--~---