mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Fixed an issue with #id expression parsing, an issue with formatting, and removed the try{} block from around event firings.
This commit is contained in:
parent
a457262ef5
commit
b5256caee6
48
jquery/jquery.js
vendored
48
jquery/jquery.js
vendored
@ -318,6 +318,16 @@ function $(a,c) {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
var b = navigator.userAgent.toLowerCase();
|
||||||
|
$.browser =
|
||||||
|
( /safari/.test(b) && "safari" ) ||
|
||||||
|
( /opera/.test(b) && "opera" ) ||
|
||||||
|
( /msie/.test(b) && "msie" ) ||
|
||||||
|
( !/compatible/.test(b) && "mozilla" ) ||
|
||||||
|
"other";
|
||||||
|
})();
|
||||||
|
|
||||||
$.apply = function(o,f,a) {
|
$.apply = function(o,f,a) {
|
||||||
a = a || [];
|
a = a || [];
|
||||||
if ( f.apply ) {
|
if ( f.apply ) {
|
||||||
@ -474,22 +484,22 @@ $.Select = function( t, context ) {
|
|||||||
var re = new RegExp( "^//", "i" );
|
var re = new RegExp( "^//", "i" );
|
||||||
t = t.replace( re, "" );
|
t = t.replace( re, "" );
|
||||||
|
|
||||||
if ( t.indexOf('..') === 0 || t.indexOf('/..') === 0 ) {
|
if ( t.indexOf('..') === 0 || t.indexOf('/..') === 0 ) {
|
||||||
if ( t.indexOf('/') === 0 ) {
|
if ( t.indexOf('/') === 0 ) {
|
||||||
t = t.substr(1,t.length);
|
t = t.substr(1,t.length);
|
||||||
}
|
}
|
||||||
r = $.map( ret, function(a){ return a.parentNode; } );
|
r = $.map( ret, function(a){ return a.parentNode; } );
|
||||||
t = t.substr(2,t.length);
|
t = t.substr(2,t.length);
|
||||||
t = $.cleanSpaces(t);
|
t = $.cleanSpaces(t);
|
||||||
} else if ( t.indexOf('>') === 0 || t.indexOf('/') === 0 ) {
|
} else if ( t.indexOf('>') === 0 || t.indexOf('/') === 0 ) {
|
||||||
r = $.map( ret, function(a){ return ( a.childNodes.length > 0 ? $.sibling( a.firstChild ) : null ); } );
|
r = $.map( ret, function(a){ return ( a.childNodes.length > 0 ? $.sibling( a.firstChild ) : null ); } );
|
||||||
t = t.substr(1,t.length);
|
t = t.substr(1,t.length);
|
||||||
t = $.cleanSpaces(t);
|
t = $.cleanSpaces(t);
|
||||||
} else if ( t.indexOf('+') === 0 ) {
|
} else if ( t.indexOf('+') === 0 ) {
|
||||||
r = $.map( ret, function(a){ return $.sibling(a).next; } );
|
r = $.map( ret, function(a){ return $.sibling(a).next; } );
|
||||||
t = t.substr(1,t.length);
|
t = t.substr(1,t.length);
|
||||||
t = $.cleanSpaces(t);
|
t = $.cleanSpaces(t);
|
||||||
} else if ( t.indexOf('~') === 0 ) {
|
} else if ( t.indexOf('~') === 0 ) {
|
||||||
r = $.map( ret, function(a){
|
r = $.map( ret, function(a){
|
||||||
var r = [];
|
var r = [];
|
||||||
var s = $.sibling(a);
|
var s = $.sibling(a);
|
||||||
@ -502,19 +512,19 @@ $.Select = function( t, context ) {
|
|||||||
});
|
});
|
||||||
t = t.substr(1,t.length);
|
t = t.substr(1,t.length);
|
||||||
t = $.cleanSpaces(t);
|
t = $.cleanSpaces(t);
|
||||||
} else if ( t.indexOf(',') === 0 || t.indexOf('|') === 0 ) {
|
} else if ( t.indexOf(',') === 0 || t.indexOf('|') === 0 ) {
|
||||||
if ( ret[0] == context ) { ret.shift(); }
|
if ( ret[0] == context ) { ret.shift(); }
|
||||||
done = $.merge( done, ret );
|
done = $.merge( done, ret );
|
||||||
r = ret = [context];
|
r = ret = [context];
|
||||||
t = " " + t.substr(1,t.length);
|
t = " " + t.substr(1,t.length);
|
||||||
} else {
|
} else {
|
||||||
var re2 = new RegExp( "^([#.]?)([a-z0-9\\*_-]*)", "i" );
|
var re2 = new RegExp( "^([#.]?)([a-z0-9\\*_-]*)", "i" );
|
||||||
var m = re2.exec(t);
|
var m = re2.exec(t);
|
||||||
|
|
||||||
if ( m[1] == "#" ) { // Ummm, should make this work in all XML docs
|
if ( m[1] == "#" ) { // Ummm, should make this work in all XML docs
|
||||||
var oid = document.getElementById(m[2]);
|
var oid = document.getElementById(m[2]);
|
||||||
r = oid ? [oid] : [];
|
r = oid ? [oid] : [];
|
||||||
t = t.replace( re, "" );
|
t = t.replace( re2, "" );
|
||||||
} else {
|
} else {
|
||||||
if ( m[2] === "" || m[1] == "." ) { m[2] = "*"; }
|
if ( m[2] === "" || m[1] == "." ) { m[2] = "*"; }
|
||||||
|
|
||||||
@ -545,9 +555,11 @@ $.Select = function( t, context ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var val = $.filter(t,r);
|
if ( t ) {
|
||||||
ret = r = val.r;
|
var val = $.filter(t,r);
|
||||||
t = $.cleanSpaces(val.t);
|
ret = r = val.r;
|
||||||
|
t = $.cleanSpaces(val.t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ret && ret[0] == context ) { ret.shift(); }
|
if ( ret && ret[0] == context ) { ret.shift(); }
|
||||||
@ -789,16 +801,14 @@ $.event.handle = function(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ( var i = 0; i < handlers.length; i++ ) {
|
for ( var i = 0; i < handlers.length; i++ ) {
|
||||||
try {
|
if ( handlers[i].constructor == Function ) {
|
||||||
if ( handlers[i].constructor == Function ) {
|
this.$$handleEvent = handlers[i];
|
||||||
this.$$handleEvent = handlers[i];
|
if (this.$$handleEvent(event) === false) {
|
||||||
if (this.$$handleEvent(event) === false) {
|
event.preventDefault();
|
||||||
event.preventDefault();
|
event.stopPropagation();
|
||||||
event.stopPropagation();
|
returnValue = false;
|
||||||
returnValue = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch(e){}
|
}
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user