Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[enhance] jquery: updgrade to 1.6.4

  • Loading branch information...
commit 59bd5295b9086f1d620296507ea4cbe61829aa1d 1 parent 1942235
François-Régis Sinot authored
View
10 build_rules.ml
@@ -413,7 +413,7 @@ rule "Client lib JS validation"
"opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
"opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
"opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
- "opabsl/jsbsl/jquery_ext_1.6.1.externs.js" ::
+ "opabsl/jsbsl/jquery_extra.externs.js" ::
(tool_deps "jschecker.jar") @
(tool_deps "jschecker_externals.js") @
(tool_deps "jschecker_clientliblib.js") @
@@ -437,7 +437,7 @@ rule "Client lib JS validation"
A"--js" :: A "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
A"--js" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
A"--js" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
- A"--js" :: A "opabsl/jsbsl/jquery_ext_1.6.1.externs.js" ::
+ A"--js" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
A"--js" :: A"qmlcps/qmlCpsClientLib.js" ::
[]
))
@@ -460,13 +460,13 @@ rule "opa-bslgenMLRuntime JS validation"
@ [ "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ;
"opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ;
"opabsl/jsbsl/selection_ext_bsldom.extern.js" ;
- "opabsl/jsbsl/jquery_ext_1.6.1.externs.js" ;
+ "opabsl/jsbsl/jquery_extra.externs.js" ;
"opabsl/opabslgenJSkeys.js" ]
)
~prods: ["opabsl/js_validation/bsl.js"]
(fun env build ->
let arg_of_file file acc = match file with (*A very dumb filter to get rid of files that we just can't fix in the first place*)
- | "opabsl/jsbsl/opabslgen_jquery-1.6.1.js.pp" -> acc
+ | "opabsl/jsbsl/opabslgen_jquery-1.6.4.js.pp" -> acc
| "opabsl/jsbsl/opabslgen_json2.js.pp" -> acc
| _ -> A "--js" :: A file :: acc
in
@@ -483,7 +483,7 @@ rule "opa-bslgenMLRuntime JS validation"
A"--externs" :: A "opabsl/jsbsl/jquery_ext_bslanchor.extern.js" ::
A"--externs" :: A "opabsl/jsbsl/jquery_ext_jQueryExtends.extern.js" ::
A"--externs" :: A "opabsl/jsbsl/selection_ext_bsldom.extern.js" ::
- A"--externs" :: A "opabsl/jsbsl/jquery_ext_1.6.1.externs.js" ::
+ A"--externs" :: A "opabsl/jsbsl/jquery_extra.externs.js" ::
A"--js_output_file" :: A"opabsl/js_validation/bsl.js" ::
google_closure_compiler_options @
(List.fold_right (fun s acc -> arg_of_file s acc) js_pp_bsl [])
View
2  opabsl/jsbsl/bsl-sources
Git LFS file not shown
View
734 opabsl/jsbsl/jquery-1.6.1.js → opabsl/jsbsl/jquery-1.6.4.js
@@ -1,5 +1,5 @@
/*!
- * jQuery JavaScript Library v1.6.1
+ * jQuery JavaScript Library v1.6.4
* http://jquery.com/
*
* Copyright 2011, John Resig
@@ -11,7 +11,7 @@
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
- * Date: Thu May 12 15:04:36 2011 -0400
+ * Date: Mon Sep 12 18:54:48 2011 -0400
*/
(function( window, undefined ) {
@@ -37,8 +37,8 @@ var jQuery = function( selector, context ) {
rootjQuery,
// A simple way to check for HTML strings or ID strings
- // (both of which we optimize for)
- quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
@@ -65,6 +65,15 @@ var jQuery = function( selector, context ) {
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z]|[0-9])/ig,
+ rmsPrefix = /^-ms-/,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return ( letter + "" ).toUpperCase();
+ },
+
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
@@ -204,7 +213,7 @@ jQuery.fn = jQuery.prototype = {
selector: "",
// The current version of jQuery being used
- jquery: "1.6.1",
+ jquery: "1.6.4",
// The default length of a jQuery object is 0
length: 0,
@@ -513,10 +522,15 @@ jQuery.extend({
return false;
}
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !hasOwn.call(obj, "constructor") &&
+ !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
@@ -566,24 +580,23 @@ jQuery.extend({
},
// Cross-browser xml parsing
- // (xml & tmp used internally)
- parseXML: function( data , xml , tmp ) {
-
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
-
- tmp = xml.documentElement;
-
- if ( ! tmp || ! tmp.nodeName || tmp.nodeName === "parsererror" ) {
+ parseXML: function( data ) {
+ var xml, tmp;
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
-
return xml;
},
@@ -603,6 +616,12 @@ jQuery.extend({
}
},
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
@@ -685,6 +704,9 @@ jQuery.extend({
},
inArray: function( elem, array ) {
+ if ( !array ) {
+ return -1;
+ }
if ( indexOf ) {
return indexOf.call( array, elem );
@@ -799,7 +821,7 @@ jQuery.extend({
},
// Mutifunctional method to get and set values to a collection
- // The value/s can be optionally by executed if its a function
+ // The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
@@ -930,7 +952,6 @@ function doScrollCheck() {
jQuery.ready();
}
-// Expose jQuery to the global object
return jQuery;
})();
@@ -1058,7 +1079,7 @@ jQuery.extend({
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject );
} else {
- newDefer[ action ]( returned );
+ newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
@@ -1147,7 +1168,9 @@ jQuery.support = (function() {
support,
fragment,
body,
- bodyStyle,
+ testElementParent,
+ testElement,
+ testElementStyle,
tds,
events,
eventName,
@@ -1158,6 +1181,7 @@ jQuery.support = (function() {
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
+
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
@@ -1241,11 +1265,10 @@ jQuery.support = (function() {
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function click() {
+ div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
- div.detachEvent( "onclick", click );
});
div.cloneNode( true ).fireEvent( "onclick" );
}
@@ -1270,22 +1293,31 @@ jQuery.support = (function() {
// Figure out if the W3C box model works as expected
div.style.width = div.style.paddingLeft = "1px";
- // We use our own, invisible, body
- body = document.createElement( "body" );
- bodyStyle = {
+ body = document.getElementsByTagName( "body" )[ 0 ];
+ // We use our own, invisible, body unless the body is already present
+ // in which case we use a div (#9239)
+ testElement = document.createElement( body ? "div" : "body" );
+ testElementStyle = {
visibility: "hidden",
width: 0,
height: 0,
border: 0,
margin: 0,
- // Set background to avoid IE crashes when removing (#9028)
background: "none"
};
- for ( i in bodyStyle ) {
- body.style[ i ] = bodyStyle[ i ];
+ if ( body ) {
+ jQuery.extend( testElementStyle, {
+ position: "absolute",
+ left: "-1000px",
+ top: "-1000px"
+ });
+ }
+ for ( i in testElementStyle ) {
+ testElement.style[ i ] = testElementStyle[ i ];
}
- body.appendChild( div );
- documentElement.insertBefore( body, documentElement.firstChild );
+ testElement.appendChild( div );
+ testElementParent = body || documentElement;
+ testElementParent.insertBefore( testElement, testElementParent.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
@@ -1344,8 +1376,8 @@ jQuery.support = (function() {
}
// Remove the body element we added
- body.innerHTML = "";
- documentElement.removeChild( body );
+ testElement.innerHTML = "";
+ testElementParent.removeChild( testElement );
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
@@ -1369,6 +1401,9 @@ jQuery.support = (function() {
}
}
+ // Null connected elements to avoid leaks in IE
+ testElement = fragment = select = opt = body = marginDiv = div = input = null;
+
return support;
})();
@@ -1379,7 +1414,7 @@ jQuery.boxModel = jQuery.support.boxModel;
var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([a-z])([A-Z])/g;
+ rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
@@ -1411,7 +1446,9 @@ jQuery.extend({
return;
}
- var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
@@ -1427,7 +1464,7 @@ jQuery.extend({
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
- if ( (!id || (pvt && id && !cache[ id ][ internalKey ])) && getByName && data === undefined ) {
+ if ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {
return;
}
@@ -1486,7 +1523,24 @@ jQuery.extend({
return thisCache[ internalKey ] && thisCache[ internalKey ].events;
}
- return getByName ? thisCache[ jQuery.camelCase( name ) ] : thisCache;
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
@@ -1494,7 +1548,12 @@ jQuery.extend({
return;
}
- var internalKey = jQuery.expando, isNode = elem.nodeType,
+ var thisCache,
+
+ // Reference to internal data cache key
+ internalKey = jQuery.expando,
+
+ isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
@@ -1509,9 +1568,16 @@ jQuery.extend({
}
if ( name ) {
- var thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
+
+ thisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];
if ( thisCache ) {
+
+ // Support interoperable removal of hyphenated or camelcased keys
+ if ( !thisCache[ name ] ) {
+ name = jQuery.camelCase( name );
+ }
+
delete thisCache[ name ];
// If there is no data left in the cache, we want to continue
@@ -1538,7 +1604,8 @@ jQuery.extend({
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
- if ( jQuery.support.deleteExpando || cache != window ) {
+ // Ensure that `cache` is not a window object #10080
+ if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
@@ -1662,7 +1729,8 @@ function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
- var name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase();
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
@@ -1882,8 +1950,7 @@ var rclass = /[\n\t\r]/g,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- rinvalidChar = /\:/,
- formHook, boolHook;
+ nodeHook, boolHook;
jQuery.fn.extend({
attr: function( name, value ) {
@@ -1912,30 +1979,31 @@ jQuery.fn.extend({
},
addClass: function( value ) {
+ var classNames, i, l, elem,
+ setClass, c, cl;
+
if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- self.addClass( value.call(this, i, self.attr("class") || "") );
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
- var classNames = (value || "").split( rspace );
+ classNames = value.split( rspace );
- for ( var i = 0, l = this.length; i < l; i++ ) {
- var elem = this[i];
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
if ( elem.nodeType === 1 ) {
- if ( !elem.className ) {
+ if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
- var className = " " + elem.className + " ",
- setClass = elem.className;
+ setClass = " " + elem.className + " ";
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
- setClass += " " + classNames[c];
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
+ setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
@@ -1948,24 +2016,25 @@ jQuery.fn.extend({
},
removeClass: function( value ) {
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- self.removeClass( value.call(this, i, self.attr("class")) );
+ var classNames, i, l, elem, className, c, cl;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
- var classNames = (value || "").split( rspace );
+ classNames = (value || "").split( rspace );
- for ( var i = 0, l = this.length; i < l; i++ ) {
- var elem = this[i];
+ for ( i = 0, l = this.length; i < l; i++ ) {
+ elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
- var className = (" " + elem.className + " ").replace(rclass, " ");
- for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[c] + " ", " ");
+ className = (" " + elem.className + " ").replace( rclass, " " );
+ for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+ className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
@@ -1984,9 +2053,8 @@ jQuery.fn.extend({
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal );
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
@@ -2020,7 +2088,7 @@ jQuery.fn.extend({
hasClass: function( selector ) {
var className = " " + selector + " ";
for ( var i = 0, l = this.length; i < l; i++ ) {
- if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
@@ -2040,7 +2108,13 @@ jQuery.fn.extend({
return ret;
}
- return (elem.value || "").replace(rreturn, "");
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
}
return undefined;
@@ -2186,20 +2260,20 @@ jQuery.extend({
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// Normalize the name if needed
- name = notxml && jQuery.attrFix[ name ] || name;
-
- hooks = jQuery.attrHooks[ name ];
+ if ( notxml ) {
+ name = jQuery.attrFix[ name ] || name;
- if ( !hooks ) {
- // Use boolHook for boolean attributes
- if ( rboolean.test( name ) &&
- (typeof value === "boolean" || value === undefined || value.toLowerCase() === name.toLowerCase()) ) {
+ hooks = jQuery.attrHooks[ name ];
- hooks = boolHook;
+ if ( !hooks ) {
+ // Use boolHook for boolean attributes
+ if ( rboolean.test( name ) ) {
+ hooks = boolHook;
- // Use formHook for forms and if the name contains certain characters
- } else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
- hooks = formHook;
+ // Use nodeHook if available( IE6/7 )
+ } else if ( nodeHook ) {
+ hooks = nodeHook;
+ }
}
}
@@ -2217,8 +2291,8 @@ jQuery.extend({
return value;
}
- } else if ( hooks && "get" in hooks && notxml ) {
- return hooks.get( elem, name );
+ } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
} else {
@@ -2235,14 +2309,9 @@ jQuery.extend({
var propName;
if ( elem.nodeType === 1 ) {
name = jQuery.attrFix[ name ] || name;
-
- if ( jQuery.support.getSetAttribute ) {
- // Use removeAttribute in browsers that support it
- elem.removeAttribute( name );
- } else {
- jQuery.attr( elem, name, "" );
- elem.removeAttributeNode( elem.getAttributeNode( name ) );
- }
+
+ jQuery.attr( elem, name, "" );
+ elem.removeAttribute( name );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {
@@ -2270,17 +2339,23 @@ jQuery.extend({
}
}
},
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabIndex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
+ // Use the value property for back compat
+ // Use the nodeHook for button elements in IE6/7 (#1954)
+ value: {
+ get: function( elem, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.get( elem, name );
+ }
+ return name in elem ?
+ elem.value :
+ null;
+ },
+ set: function( elem, value, name ) {
+ if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+ return nodeHook.set( elem, value, name );
+ }
+ // Does not return so that setAttribute is also used
+ elem.value = value;
}
}
},
@@ -2311,10 +2386,11 @@ jQuery.extend({
var ret, hooks,
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
- // Try to normalize/fix the name
- name = notxml && jQuery.propFix[ name ] || name;
-
- hooks = jQuery.propHooks[ name ];
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
@@ -2325,7 +2401,7 @@ jQuery.extend({
}
} else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
@@ -2334,14 +2410,33 @@ jQuery.extend({
}
},
- propHooks: {}
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
});
+// Add the tabindex propHook to attrHooks for back-compat
+jQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;
+
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
- return elem[ jQuery.propFix[ name ] || name ] ?
+ // Fall back to attribute presence where some booleans are not supported
+ var attrNode;
+ return jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
@@ -2356,7 +2451,7 @@ boolHook = {
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
- elem[ propName ] = value;
+ elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
@@ -2365,32 +2460,12 @@ boolHook = {
}
};
-// Use the value property for back compat
-// Use the formHook for button elements in IE6/7 (#1954)
-jQuery.attrHooks.value = {
- get: function( elem, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.get( elem, name );
- }
- return elem.value;
- },
- set: function( elem, value, name ) {
- if ( formHook && jQuery.nodeName( elem, "button" ) ) {
- return formHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
-};
-
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) {
-
- // propFix is more comprehensive and contains all fixes
- jQuery.attrFix = jQuery.propFix;
- // Use this for any attribute on a form in IE6/7
- formHook = jQuery.attrHooks.name = jQuery.valHooks.button = {
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
@@ -2400,13 +2475,13 @@ if ( !jQuery.support.getSetAttribute ) {
undefined;
},
set: function( elem, value, name ) {
- // Check form objects in IE (multiple bugs related)
- // Only use nodeValue if the attribute node exists on the form
+ // Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
- if ( ret ) {
- ret.nodeValue = value;
- return value;
+ if ( !ret ) {
+ ret = document.createAttribute( name );
+ elem.setAttributeNode( ret );
}
+ return (ret.nodeValue = value + "");
}
};
@@ -2465,6 +2540,7 @@ if ( !jQuery.support.optSelected ) {
parent.parentNode.selectedIndex;
}
}
+ return null;
}
});
}
@@ -2493,8 +2569,7 @@ jQuery.each([ "radio", "checkbox" ], function() {
-var hasOwn = Object.prototype.hasOwnProperty,
- rnamespaces = /\.(.*)$/,
+var rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = / /g,
@@ -2838,7 +2913,7 @@ jQuery.event = {
event.target = elem;
// Clone any incoming data and prepend the event, creating the handler arg list
- data = data ? jQuery.makeArray( data ) : [];
+ data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
var cur = elem,
@@ -3144,34 +3219,27 @@ jQuery.Event.prototype = {
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function( event ) {
+
// Check if mouse(over|out) are still within the same parent element
- var parent = event.relatedTarget;
+ var related = event.relatedTarget,
+ inside = false,
+ eventType = event.type;
- // set the correct event type
event.type = event.data;
- // Firefox sometimes assigns relatedTarget a XUL element
- // which we cannot access the parentNode property of
- try {
+ if ( related !== this ) {
- // Chrome does something similar, the parentNode property
- // can be accessed but is null.
- if ( parent && parent !== document && !parent.parentNode ) {
- return;
+ if ( related ) {
+ inside = jQuery.contains( this, related );
}
- // Traverse up the tree
- while ( parent && parent !== this ) {
- parent = parent.parentNode;
- }
+ if ( !inside ) {
- if ( parent !== this ) {
- // handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
- }
- // assuming we've left the element since we most likely mousedover a xul element
- } catch(e) { }
+ event.type = eventType;
+ }
+ }
},
// In case of event delegation, we only need to rename the event.type,
@@ -3203,8 +3271,9 @@ if ( !jQuery.support.submitBubbles ) {
setup: function( data, namespaces ) {
if ( !jQuery.nodeName( this, "form" ) ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
+ // Avoid triggering error on non-existent type attribute in IE VML (#7071)
var elem = e.target,
- type = elem.type;
+ type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
trigger( "submit", this, arguments );
@@ -3213,7 +3282,7 @@ if ( !jQuery.support.submitBubbles ) {
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target,
- type = elem.type;
+ type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
trigger( "submit", this, arguments );
@@ -3238,7 +3307,8 @@ if ( !jQuery.support.changeBubbles ) {
var changeFilters,
getVal = function( elem ) {
- var type = elem.type, val = elem.value;
+ var type = jQuery.nodeName( elem, "input" ) ? elem.type : "",
+ val = elem.value;
if ( type === "radio" || type === "checkbox" ) {
val = elem.checked;
@@ -5263,12 +5333,17 @@ jQuery.fn.extend({
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
- if ( !elem || typeof elem === "string" ) {
- return jQuery.inArray( this[0],
- // If it receives a string, the selector is used
- // If it receives nothing, the siblings are used
- elem ? jQuery( elem ) : this.parent().children() );
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
@@ -5890,8 +5965,21 @@ function cloneFixAttributes( src, dest ) {
}
jQuery.buildFragment = function( args, nodes, scripts ) {
- var fragment, cacheable, cacheresults,
- doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
+ var fragment, cacheable, cacheresults, doc;
+
+ // nodes may contain either an explicit document object,
+ // a jQuery collection or context object.
+ // If nodes[0] contains a valid object to assign to doc
+ if ( nodes && nodes[0] ) {
+ doc = nodes[0].ownerDocument || nodes[0];
+ }
+
+ // Ensure that an attr object doesn't incorrectly stand in as a document object
+ // Chrome and Firefox seem to allow this to occur and will throw exception
+ // Fixes #8950
+ if ( !doc.createDocumentFragment ) {
+ doc = document;
+ }
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
@@ -5972,7 +6060,7 @@ function fixDefaultChecked( elem ) {
function findInputs( elem ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
- } else if ( elem.getElementsByTagName ) {
+ } else if ( "getElementsByTagName" in elem ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
@@ -6003,7 +6091,10 @@ jQuery.extend({
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ cloneFixAttributes( srcElements[i], destElements[i] );
+ }
}
}
@@ -6021,6 +6112,8 @@ jQuery.extend({
}
}
+ srcElements = destElements = null;
+
// Return the cloned set
return clone;
},
@@ -6204,13 +6297,11 @@ function evalScript( i, elem ) {
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
- rdashAlpha = /-([a-z])/ig,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
- rrelNum = /^[+\-]=/,
- rrelNumFilter = /[^+\-\.\de]+/g,
+ rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
@@ -6218,11 +6309,7 @@ var ralpha = /alpha\([^)]*\)/i,
curCSS,
getComputedStyle,
- currentStyle,
-
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- };
+ currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
@@ -6257,13 +6344,14 @@ jQuery.extend({
// Exclude the following css properties to add px
cssNumber: {
- "zIndex": true,
+ "fillOpacity": true,
"fontWeight": true,
- "opacity": true,
- "zoom": true,
"lineHeight": true,
+ "opacity": true,
+ "orphans": true,
"widows": true,
- "orphans": true
+ "zIndex": true,
+ "zoom": true
},
// Add in properties whose names you wish to fix before
@@ -6290,14 +6378,16 @@ jQuery.extend({
if ( value !== undefined ) {
type = typeof value;
- // Make sure that NaN and null values aren't set. See: #7116
- if ( type === "number" && isNaN( value ) || value == null ) {
- return;
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
}
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && rrelNum.test( value ) ) {
- value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) );
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
@@ -6364,10 +6454,6 @@ jQuery.extend({
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
- },
-
- camelCase: function( string ) {
- return string.replace( rdashAlpha, fcamelCase );
}
});
@@ -6381,44 +6467,21 @@ jQuery.each(["height", "width"], function( i, name ) {
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
- val = getWH( elem, name, extra );
-
+ return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
- if ( val <= 0 ) {
- val = curCSS( elem, name, name );
-
- if ( val === "0px" && currentStyle ) {
- val = currentStyle( elem, name, name );
- }
-
- if ( val != null ) {
- // Should return "auto" instead of 0, use 0 for
- // temporary backwards-compat
- return val === "" || val === "auto" ? "0px" : val;
- }
- }
-
- if ( val < 0 || val == null ) {
- val = elem.style[ name ];
-
- // Should return "auto" instead of 0, use 0 for
- // temporary backwards-compat
- return val === "" || val === "auto" ? "0px" : val;
- }
-
- return typeof val === "string" ? val : val + "px";
+ return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
- value = parseFloat(value);
+ value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
@@ -6442,18 +6505,29 @@ if ( !jQuery.support.opacity ) {
set: function( elem, value ) {
var style = elem.style,
- currentStyle = elem.currentStyle;
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNaN( value ) ? "" : "alpha(opacity=" + value * 100 + ")",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
- // Set the alpha filter to set the opacity
- var opacity = jQuery.isNaN( value ) ?
- "" :
- "alpha(opacity=" + value * 100 + ")",
- filter = currentStyle && currentStyle.filter || style.filter || "";
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+ // if there there is no filter style applied in a css rule, we are done
+ if ( currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
@@ -6541,27 +6615,50 @@ if ( document.documentElement.currentStyle ) {
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
- var which = name === "width" ? cssWidth : cssHeight,
- val = name === "width" ? elem.offsetWidth : elem.offsetHeight;
- if ( extra === "border" ) {
- return val;
- }
+ // Start with offset property
+ var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ which = name === "width" ? cssWidth : cssHeight;
- jQuery.each( which, function() {
- if ( !extra ) {
- val -= parseFloat(jQuery.css( elem, "padding" + this )) || 0;
+ if ( val > 0 ) {
+ if ( extra !== "border" ) {
+ jQuery.each( which, function() {
+ if ( !extra ) {
+ val -= parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
+ } else {
+ val -= parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ });
}
- if ( extra === "margin" ) {
- val += parseFloat(jQuery.css( elem, "margin" + this )) || 0;
+ return val + "px";
+ }
- } else {
- val -= parseFloat(jQuery.css( elem, "border" + this + "Width" )) || 0;
- }
- });
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, name );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ] || 0;
+ }
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+
+ // Add padding, border, margin
+ if ( extra ) {
+ jQuery.each( which, function() {
+ val += parseFloat( jQuery.css( elem, "padding" + this ) ) || 0;
+ if ( extra !== "padding" ) {
+ val += parseFloat( jQuery.css( elem, "border" + this + "Width" ) ) || 0;
+ }
+ if ( extra === "margin" ) {
+ val += parseFloat( jQuery.css( elem, extra + this ) ) || 0;
+ }
+ });
+ }
- return val;
+ return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
@@ -6585,9 +6682,9 @@ var r20 = /%20/g,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+ rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
+ rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
@@ -6622,7 +6719,10 @@ var r20 = /%20/g,
ajaxLocation,
// Document location segments
- ajaxLocParts;
+ ajaxLocParts,
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
@@ -6715,6 +6815,22 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
return selection;
}
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var key, deep,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+ for( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+}
+
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
@@ -6858,23 +6974,16 @@ jQuery.extend({
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
- ajaxSetup: function ( target, settings ) {
- if ( !settings ) {
- // Only one parameter, we extend ajaxSettings
- settings = target;
- target = jQuery.extend( true, jQuery.ajaxSettings, settings );
+ ajaxSetup: function( target, settings ) {
+ if ( settings ) {
+ // Building a settings object
+ ajaxExtend( target, jQuery.ajaxSettings );
} else {
- // target was provided, we extend into it
- jQuery.extend( true, target, jQuery.ajaxSettings, settings );
- }
- // Flatten fields we don't want deep extended
- for( var field in { context: 1, url: 1 } ) {
- if ( field in settings ) {
- target[ field ] = settings[ field ];
- } else if( field in jQuery.ajaxSettings ) {
- target[ field ] = jQuery.ajaxSettings[ field ];
- }
+ // Extending ajaxSettings
+ settings = target;
+ target = jQuery.ajaxSettings;
}
+ ajaxExtend( target, settings );
return target;
},
@@ -6902,7 +7011,7 @@ jQuery.extend({
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
- "*": "*/*"
+ "*": allTypes
},
contents: {
@@ -6932,6 +7041,15 @@ jQuery.extend({
// Parse text as xml
"text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ context: true,
+ url: true
}
},
@@ -7042,7 +7160,7 @@ jQuery.extend({
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
- function done( status, statusText, responses, headers ) {
+ function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
@@ -7065,11 +7183,12 @@ jQuery.extend({
responseHeadersString = headers || "";
// Set readyState
- jqXHR.readyState = status ? 4 : 0;
+ jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
+ statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
@@ -7121,7 +7240,7 @@ jQuery.extend({
// Set data for the fake xhr object
jqXHR.status = status;
- jqXHR.statusText = statusText;
+ jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
@@ -7143,7 +7262,7 @@ jQuery.extend({
completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] );
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
@@ -7224,6 +7343,8 @@ jQuery.extend({
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
@@ -7261,7 +7382,7 @@ jQuery.extend({
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
@@ -7307,7 +7428,7 @@ jQuery.extend({
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
- if ( status < 2 ) {
+ if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
@@ -7955,10 +8076,7 @@ var elemdisplay = {},
// opacity animations
[ "opacity" ]
],
- fxNow,
- requestAnimationFrame = window.webkitRequestAnimationFrame ||
- window.mozRequestAnimationFrame ||
- window.oRequestAnimationFrame;
+ fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
@@ -8272,15 +8390,15 @@ jQuery.extend({
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
if ( opt.queue !== false ) {
jQuery.dequeue( this );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
-
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
};
return opt;
@@ -8334,8 +8452,7 @@ jQuery.fx.prototype = {
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
- fx = jQuery.fx,
- raf;
+ fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.start = from;
@@ -8351,20 +8468,7 @@ jQuery.fx.prototype = {
t.elem = this.elem;
if ( t() && jQuery.timers.push(t) && !timerId ) {
- // Use requestAnimationFrame instead of setInterval if available
- if ( requestAnimationFrame ) {
- timerId = 1;
- raf = function() {
- // When timerId gets set to null at any point, this stops
- if ( timerId ) {
- requestAnimationFrame( raf );
- fx.tick();
- }
- };
- requestAnimationFrame( raf );
- } else {
- timerId = setInterval( fx.tick, fx.interval );
- }
+ timerId = setInterval( fx.tick, fx.interval );
}
},
@@ -8516,7 +8620,8 @@ function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ),
+ var body = document.body,
+ elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
@@ -8530,14 +8635,15 @@ function defaultDisplay( nodeName ) {
iframe.frameBorder = iframe.width = iframe.height = 0;
}
- document.body.appendChild( iframe );
+ body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html
- // document to it, Webkit & Firefox won't allow reusing the iframe document
+ // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
+ // document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( "<!doctype><html><body></body></html>" );
+ iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
+ iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
@@ -8546,7 +8652,7 @@ function defaultDisplay( nodeName ) {
display = jQuery.css( elem, "display" );
- document.body.removeChild( iframe );
+ body.removeChild( iframe );
}
// Store the correct default display
@@ -8867,22 +8973,24 @@ function getWindow( elem ) {
-// Create innerHeight, innerWidth, outerHeight and outerWidth methods
+// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
- jQuery.fn["inner" + name] = function() {
- return this[0] ?
- parseFloat( jQuery.css( this[0], type, "padding" ) ) :
+ jQuery.fn[ "inner" + name ] = function() {
+ var elem = this[0];
+ return elem && elem.style ?
+ parseFloat( jQuery.css( elem, type, "padding" ) ) :
null;
};
// outerHeight and outerWidth
- jQuery.fn["outer" + name] = function( margin ) {
- return this[0] ?
- parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
+ jQuery.fn[ "outer" + name ] = function( margin ) {
+ var elem = this[0];
+ return elem && elem.style ?
+ parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
null;
};
@@ -8903,9 +9011,10 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
- var docElemProp = elem.document.documentElement[ "client" + name ];
+ var docElemProp = elem.document.documentElement[ "client" + name ],
+ body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
- elem.document.body[ "client" + name ] || docElemProp;
+ body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
@@ -8932,5 +9041,6 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
});
+// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
})(window);
View
11 opabsl/jsbsl/jquery-1.6.externs.js
@@ -15,7 +15,7 @@
*/
/**
- * @fileoverview Externs for jQuery 1.6
+ * @fileoverview Externs for jQuery 1.6.1
*
* Note that some functions use different return types depending on the number
* of parameters passed in. In these cases, you may need to annotate the type
@@ -1690,9 +1690,6 @@ jQuery.prototype.scrollTop = function(value) {};
*/
jQuery.prototype.select = function(arg1, handler) {};
-/** @type {string} */
-jQuery.prototype.selector;
-
/**
* @return {string}
* @nosideeffects
@@ -1862,7 +1859,7 @@ jQuery.prototype.toggleClass = function(arg1, flag) {};
/**
* @param {(string|jQuery.event)} arg1
- * @param {Array.<*>=} extraParameters
+ * @param {Object=} extraParameters
* @return {jQuery}
*/
jQuery.prototype.trigger = function(arg1, extraParameters) {};
@@ -1941,7 +1938,7 @@ jQuery.prototype.unwrap = function() {};
/**
* @param {(string|function(number,*))=} arg1
- * @return {(string|Array.<string>|jQuery)}
+ * @return {(string|number|Array.<string>|jQuery)}
*/
jQuery.prototype.val = function(arg1) {};
@@ -1979,4 +1976,4 @@ jQuery.prototype.wrapAll = function(wrappingElement) {};
* @param {(string|function())} arg1
* @return {jQuery}
*/
-jQuery.prototype.wrapInner = function(arg1) {};
+jQuery.prototype.wrapInner = function(arg1) {};
View
25 opabsl/jsbsl/jquery_ext_1.6.1.externs.js → opabsl/jsbsl/jquery_extra.externs.js
@@ -21,20 +21,17 @@
*/
/**
- This file provides prototypes for function added by side effect to jQuery
- by /opabsl/jsbsl/jquery-1.6.1.js. In effect we currently use the
- jquery-1.6.1.js version of the JS source from Google but their
- jquery-1.6.externs.js version of the JS prototypes. Hence, the present file
- fills the holes and may become useless if the Google's prototype file gets
- updated to a more recent version.
- This code is not intended to be compiled and included in any binary, it only
- serves to the Google Closure Compiler checker by giving it prototypes, hence
- avoiding warnings.
- In case the Google Closure Compiler checker is not more used by the build
- system, this source file can be discarded from the Opa sources tree.
- This source file is involved by the build system build_rules.ml for 2 rules:
- - rule "Client lib JS validation"
- - rule "opa-bslgenMLRuntime JS validation"
+ This file provides prototypes for function added by side effect to jQuery by
+ opabsl/jsbsl/jquery-1.X.Y.js. We use the jquery-1.6.externs.js version of the
+ JS prototypes from Google. The present file fills the holes and may
+ become useless if the Google's prototype file gets updated to a more recent
+ version. This code is not intended to be compiled and included in any binary,
+ it only serves to the Google Closure Compiler checker by giving it prototypes,
+ hence avoiding warnings. In case the Google Closure Compiler checker is not
+ more used by the build system, this source file can be discarded from the Opa
+ sources tree. This source file is involved by the build system build_rules.ml
+ for 2 rules: - rule "Client lib JS validation" - rule "opa-bslgenMLRuntime JS
+ validation"
**/
Please sign in to comment.
Something went wrong with that request. Please try again.