Bug Tracker

Opened 8 years ago

Closed 6 years ago

Last modified 6 years ago

#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:
Blocked by: Blocking:

Description (last modified by dmethvin)

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 (1)

jsonSupport.patch (392 bytes) - added by umbrae 8 years ago.
Adds '$.support' checking for native JSON

Download all attachments as: .zip

Change History (22)

Changed 8 years ago by umbrae

Attachment: jsonSupport.patch added

Adds '$.support' checking for native JSON

comment:1 Changed 8 years ago by umbrae

Patch attached. That rhymes a bit.

comment:2 Changed 7 years ago by dmethvin

Component: coresupport

comment:3 Changed 7 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 7 years ago by Rick Waldron

Milestone: 1.41.5
Owner: set to Rick Waldron
Priority: minorlow
Status: newassigned

comment:5 Changed 7 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 6 years ago by john

Milestone: 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 6 years ago by john

Owner: Rick Waldron deleted
Status: assignedopen

Let's look at this for 1.7.

comment:8 Changed 6 years ago by john

Keywords: 1.7-discuss added

Nominating ticket for 1.7 discussion.

comment:9 Changed 6 years ago by Rick Waldron

Description: modified (diff)

+0,

comment:10 Changed 6 years ago by jaubourg

-1, I really don't see what would be gained from this.

comment:11 Changed 6 years ago by ajpiano

Description: modified (diff)

-1, This is like putting the treasure map inside of the treasure.

comment:12 Changed 6 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 6 years ago by danheberden

-1

comment:14 Changed 6 years ago by paul.irish

Description: modified (diff)

-1, the detect is trivial, jquery wouldnt help developers with this

comment:15 Changed 6 years ago by dmethvin

-1, If we don't need it, I wouldn't add it.

comment:16 Changed 6 years ago by john

Description: modified (diff)

-1, This really isn't needed, at all.

comment:17 Changed 6 years ago by scottgonzalez

-1, Sane detection (and proper detection with Mootools' implementation) are trivial

comment:18 Changed 6 years ago by jzaefferer

-1, needs usecase

comment:19 Changed 6 years ago by cowboy

-1, $.support.JSON vs window.JSON ? I'll take door number 2, thx

comment:20 Changed 6 years ago by Rick Waldron

Milestone: 1.next1.7
Resolution: wontfix
Status: openclosed

Closing per 1.7 roadmap meeting resolution

comment:21 Changed 6 years ago by dmethvin

Description: modified (diff)
Milestone: 1.7
Note: See TracTickets for help on using tickets.