From 8e67f74e434adf26ab72903caae040fd85baf749 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
The Directional properties ( Note: The jQuery UI project extends the Note: The jQuery UI project extends the Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually. Note: if attempting to animate an element with a height or width of 0px, where contents of the element are visible due to overflow, jQuery may clip this overflow during animation. By fixing the dimensions of the original element being hidden however, it is possible to ensure that the animation runs smoothly. A clearfix can be used to automatically fix the dimensions of your main element without the need to set this manually. The second version of The remaining parameter of The remaining parameter of As of jQuery version 1.4, you can set per-property easing functions within a single For example, to simultaneously animate the width and height with the According to the W3C forms specification, the According to the W3C forms specification, the Nevertheless, the most important concept to remember about the In jQuery 1.4.3 setting an element's data object with Prior to jQuery 1.4.3 (starting in jQuery 1.4) the jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like Due to the way browsers interact with plugins and external code, the jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like jQuery 3 changes the behavior of this method to align it to the Dataset API specifications. Specifically, jQuery 3 transforms every two-character sequence of "-" (U+002D) followed by a lowercase ASCII letter by the uppercase version of the letter as per definition of the algorithm of the Dataset API. Writing a statement like As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the W3C HTML5 specification. As of jQuery 1.4.3 HTML 5 data- attributes will be automatically pulled in to jQuery's data object. The treatment of attributes with embedded dashes was changed in jQuery 1.6 to conform to the W3C HTML5 specification. For example, given the following HTML: All of the following jQuery code will work. The second statement of the code above correctly refers to the Every attempt is made to convert the string to a JavaScript value (this includes booleans, numbers, objects, arrays, and null). A value is only converted to a number if doing so doesn't change the value's representation. For example, "1E02" and "100.000" are equivalent as numbers (numeric value 100) but converting them would alter their representation so they are left as strings. The string value "100" is converted to the number 100. When the data attribute is an object (starts with '{') or array (starts with '[') then When the data attribute is an object (starts with '{') or array (starts with '[') then To retrieve the value's attribute as a string without any attempt to convert it, use the The data- attributes are pulled in the first time the data property is accessed and then are no longer accessed or mutated (all data values are then stored internally in jQuery). Calling This is the inverse of One important thing to note with :empty (and :parent) is that child elements include text nodes. The W3C recommends that the The W3C recommends that the This property was introduced in DOM level 3. This property was introduced in DOM level 3. This event method is described in the W3C DOM Level 3 specification. This event method is described in the W3C DOM Level 3 specification. Returns a boolean value ( On Macintosh keyboards, the META key maps to the Command key (⌘). On Windows keyboards, the META key maps to the Windows key. On Macintosh keyboards, the META key maps to the Command key (⌘). On Windows keyboards, the META key maps to the Windows key. As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but As of jQuery 1.6, the Note: To avoid unnecessary DOM manipulation, As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but As of jQuery 1.6, the The Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called The string representing an easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but As of jQuery 1.6, the Elements that are not in a document are not considered to be visible; jQuery does not have a way to know if they will be visible when appended to a document since it depends on the applicable styles. This selector is the opposite of the During animations to show an element, the element is considered to be visible at the start of the animation. How How jQuery 3 slightly modifies the meaning of When a duration, a plain object, or a "complete" function is provided, Durations are given in milliseconds; higher values indicate slower animations, not faster ones. The strings Note that As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called As of jQuery 1.4.3, an optional string naming an easing function may be used. Easing functions specify the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called If supplied, the callback is fired once the animation is complete. This can be useful for stringing different animations together in sequence. The callback is not sent any arguments, but Note: This method may cause performance issues, especially when used on many elements. If you're encountering such issues, use performance testing tools to determine whether this method is causing them. Moreover, this method can cause problems with responsive layouts if the display value differs at different viewport sizes. Given a document with six paragraphs, this example will set the HTML of This method uses the browser's This method uses the browser's To set the content of a Note: In Internet Explorer up to and including version 9, setting the text content of an HTML element may corrupt the text nodes of its children that are being removed from the document as a result of the operation. If you are keeping references to these DOM elements and need them to be unchanged, use For id selectors, jQuery uses the JavaScript function Calling Each If the id contains characters like periods or colons you have to escape those characters with backslashes. If the id contains characters like periods or colons you have to escape those characters with backslashes. As of jQuery 1.5.1, the Different types of response to The available data types are If If If If If If For more information on JSONP, see the original post detailing its use. For more information on JSONP, see the original post detailing its use. By default, Ajax requests are sent using the GET HTTP method. If the POST method is required, the method can be specified by setting a value for the The Prefilters can also be used to modify existing options. For example, the following proxies cross-domain requests through http://mydomain.net/proxy/: Prefilters can also be used to modify existing options. For example, the following proxies cross-domain requests through https://mydomain.net/proxy/: This property is available immediately. It is therefore safe to use it to determine whether or not to call Because Because Warning: Passing Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. Properties that are an object constructed via On a For needs that fall outside of this behavior, write a custom extend method instead, or use a library like lodash. For needs that fall outside of this behavior, write a custom extend method instead, or use a library like lodash. This property is deprecated as of version 3.0, and has no effect in browsers that support the This property is deprecated as of version 3.0, and has no effect in browsers that support the On browsers that do not support Since jQuery uses one global interval, no animation should be running or all animations should stop for the change of this property to take effect. The As of jQuery 1.5, the Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/. Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Avoid frequent hand-editing of JSON data for this reason. JSON is a data-interchange format with syntax rules that are stricter than those of JavaScript's object literal notation. For example, all strings represented in JSON, whether they are properties or values, must be enclosed in double-quotes. For details on the JSON format, see http://json.org/. If the URL includes the string "callback=?" (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the The JSON standard does not permit "control characters" such as a tab or newline. An example like Where the browser provides a native implementation of Where the browser provides a native implementation of Prior to jQuery 1.9, By default, elements are created with an If the HTML is more complex than a single tag without attributes, as it is in the above example, the actual creation of the elements is handled by the browser's When passing in complex HTML, some browsers may not generate a DOM that exactly replicates the HTML source provided. As mentioned, jQuery uses the browser's Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also convert all Filtering isn't, however, limited to these tags. For example, Internet Explorer prior to version 8 will also convert all To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag: Tags that cannot contain elements may be quick-closed or not:opacity
of the image is already at its target value, so this property is not animated by the second click. Since the target value for left
is a relative value, the image moves even farther to the right during this second animation.top
, right
, bottom
, left
) have no discernible effect on elements if their position
style property is static
, which it is by default..animate()
method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes..animate()
method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.Step Function
.animate()
provides a step
option — a callback function that is fired at each step of the animation. This function is useful for enabling custom animation types or altering the animation as it is occurring. It accepts two arguments (now
and fx
), and this
is set to the DOM element being animated.Easing
- .animate()
is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite..animate()
is a string naming an easing function to use. An easing function specifies the speed at which the animation progresses at different points within the animation. The only easing implementations in the jQuery library are the default, called swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.Per-property Easing
.animate()
call. In the first version of .animate()
, each property can take an array as its value: The first member of the array is the CSS property and the second member is an easing function. If a per-property easing function is not defined for a particular property, it uses the value of the .animate()
method's optional easing argument. If the easing argument is not defined, the default swing
function is used.swing
easing function and the opacity with the linear
easing function:
- checked
attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.checked
attribute is a boolean attribute, which means the corresponding property is true if the attribute is present at all—even if, for example, the attribute has no value or is set to empty string value or even "false". This is true of all boolean attributes.checked
attribute is that it does not correspond to the checked
property. The attribute actually corresponds to the defaultChecked
property and should be used only to set the initial value of the checkbox. The checked
attribute value does not change with the state of the checkbox, while the checked
property does. Therefore, the cross-browser-compatible way to determine if a checkbox is checked is to use the property:
.data(obj)
extends the data previously stored with that element..data()
method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.$( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.$( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
..data()
method cannot be used on <object>
(unless it's a Flash plugin), <applet>
or <embed>
elements.$( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.$( "body" ).data( { "my-name": "aValue" } ).data();
will return { myName: "aValue" }
.
HTML5 data-* Attributes
- <div data-role="page" data-last-value="43" data-hidden="true" data-options='{"name":"John"}'></div>
data-last-value
attribute of the element. In case no data is stored with the passed key, jQuery searches among the attributes of the element, converting a camel-cased string into a dashed string and then prepending data-
to the result. So, the string lastValue
is converted to data-last-value
.jQuery.parseJSON
is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.jQuery.parseJSON
is used to parse the string; it must follow valid JSON syntax including quoted property names. If the value isn't parseable as a JavaScript value, it is left as a string.attr()
method..data()
with no parameters retrieves all of the values as a JavaScript object. This object can be safely cached in a variable as long as a new object is not set with .data(obj)
. Using the object directly to get or set values is faster than making individual calls to .data()
to get or set each value::parent
. <p>
element have at least one child node, even if that child is merely text (see http://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.<p>
element have at least one child node, even if that child is merely text (see https://www.w3.org/TR/html401/struct/text.html#edef-P). Some other elements, on the other hand, are empty (i.e. have no children) by definition: <input>, <img>, <br>, and <hr>, for example.true
or false
) that indicates whether or not the META key was pressed at the time the event fired.
This key might map to an alternative key name on some platforms.fadeIn()
effectEasing
- swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.Callback Function
this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole. .promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ). .fadeOut()
will not hide an element that is already considered hidden. For information on which elements jQuery considers hidden, see :hidden Selector.Easing
- swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.Callback Function
this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole..promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ). .fadeToggle()
method animates the opacity of the matched elements. When called on a visible element, the element's display
style property is set to none
once the opacity reaches 0, so the element no longer affects the layout of the page.'fast'
and 'slow'
can be supplied to indicate durations of 200
and 600
milliseconds, respectively.Easing
- swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.Callback Function
this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole..promise()
method can be used in conjunction with the deferred.done()
method to execute a single callback for the animation as a whole when all matching elements have completed their animations ( See the example for .promise() ). :visible
selector. So, every element selected by :hidden
isn't selected by :visible
and vice versa.:hidden
is determined was changed in jQuery 1.3.2. An element is assumed to be hidden if it or any of its parents consumes no space in the document. CSS visibility isn't taken into account (therefore $( elem ).css( "visibility", "hidden" ).is( ":hidden" ) == false
). The release notes outline the changes in more detail.:hidden
is determined was changed in jQuery 1.3.2. An element is assumed to be hidden if it or any of its parents consumes no space in the document. CSS visibility isn't taken into account (therefore $( elem ).css( "visibility", "hidden" ).is( ":hidden" ) == false
). The release notes outline the changes in more detail.:hidden
(and therefore of :visible
). Starting with this version, elements will be considered :hidden
if they don't have any layout boxes. For example, br
elements and inline elements with no content will not be selected by the :hidden
selector..hide()
becomes an animation method. The .hide()
method animates the width, height, and opacity of the matched elements simultaneously. When these properties reach 0, the display
style property is set to none
to ensure that the element no longer affects the layout of the page.'fast'
and 'slow'
can be supplied to indicate durations of 200
and 600
milliseconds, respectively..hide()
is fired immediately and will override the animation queue if no duration or a duration of 0 is specified.swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.swing
, and one that progresses at a constant pace, called linear
. More easing functions are available with the use of plug-ins, most notably the jQuery UI suite.this
is set to the DOM element being animated. If multiple elements are animated, it is important to note that the callback is executed once per matched element, not once for the animation as a whole.<div class="demo-container">
to <p>All new content for <em>6 paragraphs!</em></p>
.innerHTML
property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.innerHTML
property. Some browsers may not generate a DOM that exactly replicates the HTML source provided. For example, Internet Explorer prior to version 8 will convert all href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.<script>
element, which does not contain HTML, use the .text()
method and not .html()
..empty().html( string )
instead of .html(string)
so that the elements are removed from the document before the new string is assigned to the element.document.getElementById()
, which is extremely efficient. When another selector is attached to the id selector, such as h2#pageTitle
, jQuery performs an additional check before identifying the element as a match.jQuery()
(or $()
) with an id selector as its argument will return a jQuery object containing a collection of either zero or one DOM element.id
value must be used only once within a document. If more than one element has been assigned the same ID, queries that use that ID will only select the first matched element in the DOM. This behavior should not be relied on, however; a document with more than one element using the same ID is invalid."xml"
: Returns a XML document that can be processed via jQuery."html"
: Returns HTML as plain text; included script tags are evaluated when inserted in the DOM."script"
: Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP]
, to the URL unless the cache
option is set to true
. Note: This will turn POSTs into GETs for remote-domain requests."json"
: Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json"
requests that have a callback placeholder, e.g. ?callback=?
, are performed using JSONP unless the request includes jsonp: false
in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null
or {}
instead. (See json.org for more information on proper JSON formatting.)"jsonp"
: Loads in a JSON block using JSONP. Adds an extra "?callback=?"
to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]"
, to the URL unless the cache
option is set to true
."json"
: Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json"
requests that have a callback placeholder, e.g. ?callback=?
, are performed using JSONP unless the request includes jsonp: false
in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null
or {}
instead. (See json.org for more information on proper JSON formatting.)"jsonp"
: Loads in a JSON block using JSONP. Adds an extra "?callback=?"
to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]"
, to the URL unless the cache
option is set to true
."text"
: A plain text string."text xml"
for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: "jsonp text xml"
. Similarly, a shorthand string such as "jsonp xml"
will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml.jqXHR
object also contains the overrideMimeType()
method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). The .overrideMimeType()
method may be used in the beforeSend()
callback function, for example, to modify the response content-type header:
-
$.ajax({
- url: "http://fiddle.jshell.net/favicon.png",
+ url: "https://fiddle.jshell.net/favicon.png",
beforeSend: function( xhr ) {
xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
}
@@ -326,11 +326,11 @@ jqxhr.always(function() {
$.ajax()
call are subjected to different kinds of pre-processing before being passed to the success handler. The type of pre-processing depends by default upon the Content-Type of the response, but can be set explicitly using the dataType
option. If the dataType
option is provided, the Content-Type header of the response will be disregarded.text
, html
, xml
, json
, jsonp
, and script
.text
or html
is specified, no pre-processing occurs. The data is simply passed on to the success handler, and made available through the responseText
property of the jqXHR
object.xml
is specified, the response is parsed using jQuery.parseXML
before being passed, as an XMLDocument
, to the success handler. The XML document is made available through the responseXML
property of the jqXHR
object.xml
is specified, the response is parsed using jQuery.parseXML
before being passed, as an XMLDocument
, to the success handler. The XML document is made available through the responseXML
property of the jqXHR
object.json
is specified, the response is parsed using jQuery.parseJSON
before being passed, as an object, to the success handler. The parsed JSON object is made available through the responseJSON
property of the jqXHR
object.script
is specified, $.ajax()
will execute the JavaScript that is received from the server before passing it on to the success handler as a string.jsonp
is specified, $.ajax()
will automatically append a query string parameter of (by default) callback=?
to the URL. The jsonp
and jsonpCallback
properties of the settings passed to $.ajax()
can be used to specify, respectively, the name of the query string parameter and the name of the JSONP callback function. The server should return valid JavaScript that passes the JSON response into the callback function. $.ajax()
will execute the returned JavaScript, calling the JSONP callback function, before passing the JSON object contained in the response to the $.ajax()
success handler.Sending Data to the Server
type
option. This option affects how the contents of the data
option are sent to the server. POST data will always be transmitted to the server using UTF-8 charset, per the W3C XMLHTTPRequest standard.data
option can contain either a query string of the form key1=value1&key2=value2
, or an object of the form {key1: 'value1', key2: 'value2'}
. If the latter form is used, the data is converted into a query string using jQuery.param()
before it is sent. This processing can be circumvented by setting processData
to false
. The processing might be undesirable if you wish to send an XML object to the server; in this case, change the contentType
option from application/x-www-form-urlencoded
to a more appropriate MIME type.
$.ajaxPrefilter(function( options ) {
if ( options.crossDomain ) {
- options.url = "http://mydomain.net/proxy/" + encodeURIComponent( options.url );
+ options.url = "https://mydomain.net/proxy/" + encodeURIComponent( options.url );
options.crossDomain = false;
}
});
diff --git a/entries/jQuery.boxModel.xml b/entries/jQuery.boxModel.xml
index f260538a..ac464850 100644
--- a/entries/jQuery.boxModel.xml
+++ b/entries/jQuery.boxModel.xml
@@ -4,7 +4,7 @@
$(document).ready()
.
The $.browser
property is deprecated in jQuery 1.3, and its functionality may be moved to a team-supported plugin in a future release of jQuery.$.browser
uses navigator.userAgent
to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. Instead of relying on $.browser
it's better to use libraries like Modernizr.$.browser
uses navigator.userAgent
to determine the platform, it is vulnerable to spoofing by the user or misrepresentation by the browser itself. It is always best to avoid browser-specific code entirely where possible. Instead of relying on $.browser
it's better to use libraries like Modernizr.false
for the first argument is not supported.new MyCustomObject(args)
, or built-in JavaScript types such as Date or RegExp, are not re-constructed and will appear as plain Objects in the resulting object or array.deep
extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not. Deep-extending a cyclical data structure will result in an error.requestAnimationFrame
method.requestAnimationFrame
method.requestAnimationFrame
, this property can be changed to adjust the interval at which animations will run. The default is 13 milliseconds.success
callback is passed the returned data, which is typically a JavaScript object or array as defined by the JSON structure and parsed using the $.parseJSON()
method. It is also passed the text status of the response.success
callback function receives a "jqXHR" object (in jQuery 1.4, it received the XMLHttpRequest
object). However, since JSONP and cross-domain GET requests do not use XHR, in those cases the jqXHR
and textStatus
parameters passed to the success callback are undefined.JSONP
jsonp
data type in $.ajax()
for more details."NaN"
(NaN
cannot be represented in a JSON string; direct representation of Infinity
is also not permitted).$.parseJSON( '{ "testing":"1\t2\n3" }' )
will throw an error in most implementations because the JavaScript parser converts the string's tab and newline escapes into literal tab and newline; doubling the backslashes like "1\\t2\\n3"
yields expected results. This problem is often seen when injecting JSON into a JavaScript file from a server-side language such as PHP.JSON.parse
, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.JSON.parse
, jQuery uses it to parse the string. For details on the JSON format, see http://json.org/.$.parseJSON
returned null
instead of throwing an error if it was passed an empty string, null
, or undefined
, even though those are not valid JSON.jQuery.support
.jQuery.support
..ownerDocument
matching the document into which the jQuery library was loaded. Elements being injected into a different document should be created using that document, e.g., $("<p>hello iframe</p>", $("#myiframe").prop("contentWindow").document)
..innerHTML
mechanism. In most cases, jQuery creates a new <div>
element and sets the innerHTML
property of the element to the HTML snippet that was passed in. When the parameter has a single tag (with optional closing tag or quick-closing) — $( "<img />" )
or $( "<img>" )
, $( "<a></a>" )
or $( "<a>" )
— jQuery creates the element using the native JavaScript .createElement()
function..innerHTML
property to parse the passed HTML and insert it into the current document. During this process, some browsers filter out certain elements such as <html>
, <title>
, or <head>
elements. As a result, the elements inserted may not be representative of the original string passed.href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.href
properties on links to absolute URLs, and Internet Explorer prior to version 9 will not correctly handle HTML5 elements without the addition of a separate compatibility layer.
+ $( "<a href='http://jquery.com'></a>" );
$( "<a href='https://jquery.com'></a>" );
$( "<img>" );
diff --git a/entries/keypress.xml b/entries/keypress.xml
index 96b6b6c6..0fd28cf3 100644
--- a/entries/keypress.xml
+++ b/entries/keypress.xml
@@ -61,7 +61,7 @@ $( "#other" ).click(function() {