Skip to main content

Bug Tracker

Side navigation

#3277 closed bug (wontfix)

Opened August 21, 2008 03:51PM UTC

Closed October 06, 2008 02:57PM UTC

Last modified March 14, 2012 09:15PM UTC

'eval' in IE will not return function values, therefore json data == "function() {}" doesn't work.

Reported by: harningt Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: Cc: harningt, flesler
Blocked by: Blocking:

Related to #1298 and [2092] - the fix breaks evaluation of functions in "json" data...

Ex: eval("(function() {})") returns undefined in IE

Technically this isn't really JSON data, but isn't even dealt w/ by any other dataType except by taking it in as text and eval-ing it with the old method.... so long as you don't "pack" it... (though I suppose doing the following works ... but is ugly....

eval("data = function() {}");

data = eval("data")

Attachments (0)
Change History (3)

Changed August 22, 2008 01:19AM UTC by flesler comment:1

cc: → harningt, flesler
need: ReviewTest Case

That does that happen for functions inside json objects ? or only for "just-one-function" responses ?

Changed August 22, 2008 03:35PM UTC by arrix comment:2

data = eval("false || (" + data + ")");

works with "function() {...}" as well as any other expression.

Changed October 06, 2008 02:57PM UTC by john comment:3

resolution: → wontfix
status: newclosed

Yeah, I don't think we can guarantee arbitrary expressions as JSON when, in fact, they aren't JSON.