Skip to main content

Bug Tracker

Side navigation

#14435 closed feature (notabug)

Opened October 10, 2013 07:20AM UTC

Closed October 13, 2013 12:14PM UTC

Serializing the value of text() from empty DOM element in IE8 result "null" string

Reported by: randing89 Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

This is a known issue in IE8 which described here:

When trying to use JSON.stringify() to serialize the value of an empty DOM element. It returns "null" instead of "".

It would be better if JQuery can handle this issue.

Test code:

var t = $('div').text();

Attachments (0)
Change History (1)

Changed October 13, 2013 12:14PM UTC by dmethvin comment:1

resolution: → notabug
status: newclosed

jQuery doesn't provide any shim for stringifying to a JSON object so this is out of scope. As a workaround in your code, just include json2.js and use it instead of the native window.JSON object.