Side navigation
#1529 closed bug (wontfix)
Opened August 23, 2007 11:30AM UTC
Closed September 18, 2007 02:04PM UTC
jquery conflicts with json library
Reported by: | mkirst | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | 1.1.4 |
Component: | core | Version: | 1.1.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When using jquery together with library json (from http://www.json.org/) it results in conflicts.
I've tested two different versions from json.
I've added sample files illustrating the bug.
Attachments (3)
Change History (3)
Changed August 23, 2007 02:44PM UTC by comment:1
Changed August 23, 2007 05:39PM UTC by comment:2
Thanks for your quick help. So, better close this "bug" ;-)
As a matter of fact, I'm developing portlets for Liferay Enterprise Portal.
And as a portlet (JSR-168) I'm not allowed (or have any influence)
on the libraries use by the portal. So unfortunately I refactored
my code not to use jQuery.
But I will send the Liferay guys a message, hopefully the fix it in next versions.
Changed September 18, 2007 02:04PM UTC by comment:3
resolution: | → wontfix |
---|---|
status: | new → closed |
As already mentioned by aheimlich, the JSON library extends the Object's prototype. Unfortunately we cannot support the untold number of issues brought about by doing so.
Actually, it's the other way around. Crockford's JSON library conflicts with jQuery (and pretty much other library out there as well). The primary offender is
Object.prototype.toJSONString
, which completely screws up all of thefor...in
loops that jQuery uses![1].There was a discussion about protecting jQuery from people who tamper with
Object.prototype
a long time ago, but the dev team decided against it (can't remember exactly why), so I doubt this will ever be "fixed". IIRC, though, people have posted versions of json.js that don't mess withObject.prototype
to the mailing list, so you could do a search and see what you find.![1] http://erik.eae.net/archives/2005/06/06/22.13.54