Description: A collection of properties that represent the presence of different browser features or bugs. Primarily intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance.
version added: 1.3jQuery.support
Rather than using
$.browser to detect the current user agent and alter the page presentation based on which browser is running, it is a good practice to use feature detection. To make this process simpler, jQuery performs many such tests and sets properties of the
Since jQuery requires these tests internally, they must be performed on every page load. Although some of these properties are documented below, they are not subject to a long deprecation/removal cycle and may be removed once internal jQuery code no longer needs them.
Following are a few resources that explain how feature detection works:
For your own project's feature-detection needs, we strongly recommend the use of an external library such as Modernizr instead of dependency on properties in
The tests included in
jQuery.support are as follows:
ajaxis equal to true if a browser is able to create an
boxModelis equal to true if the page is rendering according to the W3C CSS Box Model (is currently false in IE 6 and 7 when they are in Quirks Mode). This property is null until document ready occurs.
changeBubblesis equal to true if the change event bubbles up the DOM tree, as required by the W3C DOM event model. (It is currently false in IE, and jQuery simulates bubbling).
checkCloneis equal to true if a browser correctly clones the checked state of radio buttons or checkboxes in document fragments.
checkOnis equal to true if the value of a checkbox defaults to "on" when no value is specified.
corsis equal to true if a browser can create an
XMLHttpRequestobject and if that
XMLHttpRequestobject has a
withCredentialsproperty. To enable cross-domain requests in environments that do not support cors yet but do allow cross-domain XHR requests (windows gadget, etc), set
$.support.cors = true;. CORS WD
cssFloatis equal to true if the name of the property containing the CSS float value is .cssFloat, as defined in the CSS Spec. (It is currently false in IE, it uses styleFloat instead).
hrefNormalizedis equal to true if the
.getAttribute()method retrieves the
hrefattribute of elements unchanged, rather than normalizing it to a fully-qualified URL. (It is currently false in IE, the URLs are normalized).
htmlSerializeis equal to true if the browser is able to serialize/insert
<link>elements using the
.innerHTMLproperty of elements. (is currently false in IE).
leadingWhitespaceis equal to true if the browser inserts content with .innerHTML exactly as provided—specifically, if leading whitespace characters are preserved. (It is currently false in IE 6-8).
noCloneCheckedis equal to true if cloned DOM elements copy over the state of the
.checkedexpando. (It is currently false in IE). (Added in jQuery 1.5.1)
noCloneEventis equal to true if cloned DOM elements are created without event handlers (that is, if the event handlers on the source element are not cloned). (It is currently false in IE).
opacityis equal to true if a browser can properly interpret the opacity style property. (It is currently false in IE, it uses alpha filters instead).
optDisabledis equal to true if option elements within disabled select elements are not automatically marked as disabled.
optSelectedis equal to true if an
<option>element that is selected by default has a working
scriptEval()is equal to true if inline scripts are automatically evaluated and executed when inserted into the document using standard DOM manipulation methods such as
.createTextNode(). (It is currently false in IE, it uses
.textto insert executable scripts).Note: No longer supported; removed in jQuery 1.6. Prior to jQuery 1.5.1, the
scriptEval()method was the static
scriptEvalproperty. The change to a method allowed the test to be deferred until first use to prevent content security policy inline-script violations.
styleis equal to true if inline styles for an element can be accessed through the DOM attribute called style, as required by the DOM Level 2 specification. In this case,
.getAttribute('style')can retrieve this value; in Internet Explorer,
.cssTextis used for this purpose.
submitBubblesis equal to true if the submit event bubbles up the DOM tree, as required by the W3C DOM event model. (It is currently false in IE, and jQuery simulates bubbling).
tbodyis equal to true if an empty
<table>element can exist without a
<tbody>element. According to the HTML specification, this sub-element is optional, so the property should be true in a fully-compliant browser. If false, we must account for the possibility of the browser injecting
<tbody>tags implicitly. (It is currently false in IE, which automatically inserts
tbodyif it is not present in a string assigned to
Example: Returns the box model for the iframe.
Example: Returns false if the page is in QuirksMode in Internet Explorer