Okay, I was under the impression OP was asking about a more serious incompatibility in actual code (and not in the dev-tools console), crisis averted :x
> On Apr 13, 2016, at 12:31 PM, ziyunfei <[email protected]> wrote: > > If you see this then you will understand. > https://chromium.googlesource.com/chromium/src/+/4fd348fdb9c0b3842829acdfb2b82c86dacd8e0a/third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js#215 > > On 4/13/16 12:08 PM, Boris Zbarsky wrote: > > It sounds like all the actual JS engines involved get all of this right; > > the only difference is whether evaluation in the browser's console > > happens in an expression context or in a statement context. > > And in particular, it seems like most browsers evaluate console stuff in > a statement context, but Chrome is somewhat inconsistent about it. Some > experimentation suggests the following is happening, for various input > strings: > > 1) "{}": expression context; claims to be an Object. > 2) " {}": expression context. > 3) "var x = 1": statement context; defines a property named "x" on > the global. > 4) "let x = 1": statement context; creates a binding for "x". > 5) "function f() {}": statement context; defines a property named "f" > on the global. > > I haven't experimented with more interesting whitespace preceding a '{' > but it looks like the heuristic is to use expression context if the > first non-whitespace character is '{' and to use statement context > otherwise or something. > > -Boris > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

