This is a weird IE quirk. Here are the steps:
true.toJSON()
it returns true
. No other browser does this. It's giving me issues because it's causing the tooltip widget of jQueryUI to fail for IE because at some point it passes a boolean value of true
to $.isEmptyObject()
. Normally passing in true
would just return true
but since true
now has a method associated with it (toJSON
) it is returning false
and breaking the widget.
I noticed there are some sites (like Google) that you can try to do the same test and true.toJSON()
just breaks without returning anything. What is this weird toJSON
method and how do I get rid of it?
From the jQuery.isEmptyObject()
documentation:
The argument should always be a plain JavaScript Object as other types of object (DOM elements, primitive strings/numbers, host objects) may not give consistent results across browsers.
In other words, fix the tooltip widget.