-
Website
http://kid666.com/blog -
Original page
http://kid666.com/blog/2006/12/23/security-ajax-json-satisfaction/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
wwriehriwehitertt
1 comment · 1 points
-
sh1mmer
2 comments · 1 points
-
Galapagos Cruises
1 comment · 1 points
-
Domain Names
1 comment · 1 points
-
tommorris
1 comment · 2 points
-
-
Popular Threads
-
iPhone world data congress
2 weeks ago · 2 comments
-
iPhone world data congress
Look at this Spider Monkey session:
js> {"foo": "bar"}
typein:156: SyntaxError: invalid label:
typein:156: {"foo": "bar"}
typein:156: ......^
js> {quz: "quux"}
quux
js> ({quack: "like a duck"}).quack
like a duck
js> ({quack: "like a duck", jump: "like a kangaroo"}).quack
like a duck
js> ({quack: "like a duck", jump: "like a kangaroo"}).jump
like a kangaroo
js> ({"boo": "like a ghost"}).boo
like a ghost
js> ({"boo": "like a ghost", "flash": "like a firefly"}).flash
like a firefly
js> {"boo": "like a ghost"}
typein:165: SyntaxError: invalid label:
typein:165: {"boo": "like a ghost"}
typein:165: ......^
-So to me it appears that there is some grammatical construct which I'm unfamiliar with interfering with the general grammar of object literals. Also, notice these work:
js> x={"boo": "foo"}
[object Object]
js> var y = {"boo": "foo"}
js> y
[object Object]
I guess the next step is to read the javascript grammar to understand what's happening here.
Arrays on the other hand got a bit of syntactic sugar added to make anonymous arrays valid to allow for multidimensional arrays. This means including an unassigned array object is valid Javascript (but not JSON).
It should be noted though that 3rd party Javascript needs something like AdSafe or Caja to make it safe before you can consider using it on your page. 3rd party scripts can overload Object constructors or other functions to get access to private data.
Cheers,
sweethomeimprove.com