Ticket #4977 (closed enhancement: wontfix)
Add $.support for native JSON
| Reported by: | FarSeeing | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | support | Version: | 1.3.2 |
| Keywords: | 1.7-discuss | Cc: | |
| Blocking: | Blocked by: |
Description (last modified by dmethvin) (diff)
Following http://dev.jquery.com/ticket/4429:
Would be nice to add a property in $.support to indicate that browser has a native JSON support:
jQuery.support = {
...,
json: typeof JSON === "object"
}
Attachments
Change History
Changed 4 years ago by umbrae
-
attachment
jsonSupport.patch
added
comment:3 Changed 3 years ago by dmethvin
What's the appropriate name for this property? json? nativeJSON?
If/when this is added, update $.parseJSON to use it.
// Try to use the native JSON parser first return window.JSON && window.JSON.parse ?
becomes
// Try to use the native JSON parser first return jQuery.support.nativeJSON ?
comment:4 Changed 3 years ago by rwaldron
- Owner set to rwaldron
- Priority changed from minor to low
- Status changed from new to assigned
- Milestone changed from 1.4 to 1.5
comment:5 Changed 2 years ago by snover
I can’t help but feel like this will just bloat the code for no reason and would really vote against implementing it. Many of the support tests are fairly complicated and rely on similar markup so it makes sense to run them all at once, but checking for window.JSON is no harder than checking for $.support.json. It’s also shorter.
comment:6 Changed 2 years ago by john
- Milestone set to 1.next
Yeah, I agree that's it's quite simple, although we are doing that particular feature test every time parseJSON is called (window.JSON && window.JSON.parse). We could easily offload that to jQuery.support.
comment:7 Changed 2 years ago by john
- Owner rwaldron deleted
- Status changed from assigned to open
Let's look at this for 1.7.
comment:8 Changed 2 years ago by john
- Keywords 1.7-discuss added
Nominating ticket for 1.7 discussion.
comment:10 Changed 2 years ago by jaubourg
-1, I really don't see what would be gained from this.
comment:11 Changed 2 years ago by ajpiano
- Description modified (diff)
-1, This is like putting the treasure map inside of the treasure.
comment:12 Changed 2 years ago by timmywil
- Description modified (diff)
-1, Unless we want to do our own JSON compatibility functions, I don't see the need.
comment:13 Changed 2 years ago by danheberden
-1
comment:14 Changed 2 years ago by paul.irish
- Description modified (diff)
-1, the detect is trivial, jquery wouldnt help developers with this
comment:15 Changed 2 years ago by dmethvin
-1, If we don't need it, I wouldn't add it.
comment:16 Changed 2 years ago by john
- Description modified (diff)
-1, This really isn't needed, at all.
comment:17 Changed 2 years ago by scott.gonzalez
-1, Sane detection (and proper detection with Mootools' implementation) are trivial
comment:18 Changed 2 years ago by jzaefferer
-1, needs usecase
comment:19 Changed 2 years ago by cowboy
-1, $.support.JSON vs window.JSON ? I'll take door number 2, thx
comment:20 Changed 2 years ago by rwaldron
- Status changed from open to closed
- Resolution set to wontfix
- Milestone changed from 1.next to 1.7
Closing per 1.7 roadmap meeting resolution
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Adds '$.support' checking for native JSON