X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=7db0a8c9b15654dc8359057bfc74669119947095;hb=43c4b64f328c5d6f2642f6dcf33eb27c377c0491;hp=5e1f0b051b9c5ce1e2ab30279c3ed8d2de2201c4;hpb=e87d2c7a5812299ae8390987aec21cc954a8e45a;p=jquery.git diff --git a/src/core.js b/src/core.js index 5e1f0b0..7db0a8c 100644 --- a/src/core.js +++ b/src/core.js @@ -21,7 +21,7 @@ var jQuery = window.jQuery = window.$ = function( selector, context ) { // A simple way to check for HTML strings or ID strings // (both of which we optimize for) -var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/, +var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.]*$/, @@ -266,7 +266,7 @@ jQuery.fn = jQuery.prototype = { return jQuery.find( selector, elem ); }); - return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? + return this.pushStack( /[^+>] [^+>]/.test( selector ) ? jQuery.unique( elems ) : elems ); }, @@ -441,7 +441,7 @@ jQuery.fn = jQuery.prototype = { }, eq: function( i ) { - return this.slice( i, i + 1 ); + return this.slice( i, +i + 1 ); }, slice: function() { @@ -943,12 +943,12 @@ jQuery.extend({ context = context.ownerDocument || context[0] && context[0].ownerDocument || document; jQuery.each(elems, function(i, elem){ + if ( typeof elem == 'number' ) + elem += ''; + if ( !elem ) return; - if ( elem.constructor == Number ) - elem += ''; - // Convert html string into DOM nodes if ( typeof elem == "string" ) { // Fix "XHTML"-style tags in all browsers @@ -1221,7 +1221,7 @@ var userAgent = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { - version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], + version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), @@ -1309,7 +1309,7 @@ jQuery.each({ remove: function( selector ) { if ( !selector || jQuery.filter( selector, [ this ] ).r.length ) { // Prevent memory leaks - jQuery( "*", this ).add(this).each(function(){ + jQuery( "*", this ).add([this]).each(function(){ jQuery.event.remove(this); jQuery.removeData(this); }); @@ -1368,4 +1368,4 @@ jQuery.each([ "Height", "Width" ], function(i, name){ // Helper function used by the dimensions and offset modules function num(elem, prop) { return elem[0] && parseInt( jQuery.curCSS(elem[0], prop, true), 10 ) || 0; -} \ No newline at end of file +}