Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
javascript
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
4 Jan 2010 at 16:11 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
mfer commentedIs there a reason data is being overwritten and returned?
The patch I posted on the duplicate just returned the result of either the JSON.parse or new Function method. Is there a benefit of data being overwritten and returned?
Comment #4
casey commentedNo reason. I like yours better too.
Comment #5
c960657 commentedIs the Function approach better than eval or just different? I think we use single where possible in JS also.
Comment #6
mfer commented@c960657 IMHO it's a better approach. This is the approach jQuery and other libraries are taking. jQuery uses the same approach (same code, too) as the patches here.
You can check out details on the jQuery switch in it's issue at http://dev.jquery.com/ticket/4680 and you can see the commit at http://github.com/jquery/jquery/commit/90a87c03b4943d75c24bc5e6246630231....
Comment #7
mfer commentedBump, the patch in #3 still applies.
Comment #8
casey commentedI'd say RTBC. Anyone else?
Comment #9
robloachI'd trust jQuery.getJSON over Drupal.parseJSON anyday, but this is a good first step to make sure they're aligned before replacing them. If they arn't the same, we should eventually take steps to either push the missing functionality back into jQuery, or take steps to align them properly. Maybe instead of won't fix, we push #242642: Drupal.parseJson should be removed in favor of jQuery.getJSON to Drupal 8?
This is a good step for now, though.
Comment #10
int commentedjQuery 1.4.1 as been released with New Features and fix for parseJSON.
http://jquery14.com/day-12/jquery-141-released
Comment #11
mbutcher commentedReviewed, and this does look like a good solution. Using JSON.parse where possible is totally the right move. And following jQuery is generally a safe bet.
Comment #12
casey commentedPostponed per #10: we should wait for #653580: Upgrade to jQuery 1.4 to land and use jQuery.parseJSON (http://api.jquery.com/jQuery.parseJSON/)
Comment #13
casey commentedPatch can be committed when #653580: Upgrade to jQuery 1.4 is fixed (which can be any day now).
Comment #14
robloachComment #15
mfer commentedYay for cool stuff added in jQuery 1.4.1!
Comment #16
dries commentedCommitted to CVS HEAD. Thanks.
Comment #18
tr commentedPorting a module to D7, I couldn't find any mention of this change in the documentation http://drupal.org/update/modules/6/7
Adding a "Needs Documentation" tag.
Comment #19
mfer commentedGood documentation catch. Fixed. You can see it at http://drupal.org/update/modules/6/7#Drupal.parseJSON
Comment #20
btully commentedsubscribe
Comment #21
krishworks commentedthis needs backport for drupal 6. After updating jquery to 1.7 in drupal 6, some of the functionality stopped working. eg. ajax link to view older heartbeat messages. A direct replacement of code below works fine.
replace
with
Comment #22
krishworks commentedpatch to be ported for drupal 6
Comment #23
oriol_e9g