Revision: 5436
Author: [email protected]
Date: Tue Jun 4 10:53:51 2013
Log: Edited wiki page SES through web user interface.
http://code.google.com/p/google-caja/source/detail?r=5436
Modified:
/wiki/SES.wiki
=======================================
--- /wiki/SES.wiki Sat Jun 1 12:42:39 2013
+++ /wiki/SES.wiki Tue Jun 4 10:53:51 2013
@@ -195,7 +195,7 @@
In ES5, in most way, `typeof` acts as a unary operator -- the operand
expression is evaluated to a value, and then `typeof` examines that value.
If the evaluation of the operand throws an error, the throw propagates and
the `typeof` work is skipped. However, ES5 and Source-SES make one special
case: If the operand is a simple variable name which names a non-existent
variable, i.e., if there is no corresponding variable definition or global
property, then the variable name as expression would normally throw a
`ReferenceError`. This is indeed its behavior under Target-SES because we
have no other choice. But under ES5 and Source-SES, in this special
circumstance, no error is thrown and the `typeof` expression returns the
string `"undefined"`.
-To write `typeof` tests that operates the same way under ES5, SES, and
Target-SES, using the above framework giving us a `global` binding,
replace "`typeof foo`" with "`typeof global.foo`".
+To write `typeof` tests that operate the same way under ES5, Source-SES,
and Target-SES, using the above framework giving us a `global` binding,
replace "`typeof foo`" with "`typeof global.foo`".
{{{
(function(global) {
@@ -208,7 +208,13 @@
== `this`-binding of Global Function Calls ==
-In ES3, ES5-non-strict, when a global function is called as a function,
its `this`-binding is the global object. In ES5-strict and in Source-SES,
its `this`-binding is `undefined`. Unfortunately, the Target-SES behavior
is more like the ES3 and ES5-non-strict behavior, but the global in
question is the scope object for that Target-SES evaluation.
+In ES3 and ES5-non-strict, when a global function is called as a function,
its `this`-binding is the global object. In ES5-strict and in Source-SES,
its `this`-binding is `undefined`. Unfortunately, the Target-SES behavior
is more like the ES3 and ES5-non-strict behavior, but the global in
question is the scope object for that Target-SES evaluation.
+
+To write function calls that operate the same way under ES5-strict,
Source-SES, and Target-SES, always wrap the function to be called in an
otherwise-useless comma expression:
+
+{{{
+ ... (1,foo)() ... // like conventional "foo()"
+}}}
== Safety of Thrown Values ==
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.