Opened 15 years ago
Closed 15 years ago
#1529 closed bug (wontfix)
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 (6)
Changed 15 years ago by
Attachment: | crash.html added |
---|
comment:1 follow-up: 2 Changed 15 years ago by
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 the for...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 with Object.prototype
to the mailing list, so you could do a search and see what you find.
comment:2 Changed 15 years ago by
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.
comment:3 Changed 15 years ago by
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.
sample html code