X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=jquery%2Fjquery.js;h=1e1e4abafe2f43d292add3cc10fd6c38c66495a3;hb=55370e571081930d99128e71bae4fdb5f025b558;hp=a275b02069458b98ecac398ffeb76836e8628f1e;hpb=6596108635d88116be67f6d22183588822e41c44;p=jquery.git
diff --git a/jquery/jquery.js b/jquery/jquery.js
index a275b02..1e1e4ab 100644
--- a/jquery/jquery.js
+++ b/jquery/jquery.js
@@ -318,6 +318,16 @@ function $(a,c) {
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) {
a = a || [];
if ( f.apply ) {
@@ -377,8 +387,16 @@ $.clean = function(a) {
var r = [];
for ( var i = 0; i < a.length; i++ ) {
if ( a[i].constructor == String ) {
+ if ( a[i].indexOf("
" + a[i] + "";
+ }
var div = document.createElement("div");
div.innerHTML = a[i];
+ if ( tr ) {
+ div = div.firstChild.firstChild;
+ }
for ( var j = 0; j < div.childNodes.length; j++ ) {
r[r.length] = div.childNodes[j];
}
@@ -474,22 +492,22 @@ $.Select = function( t, context ) {
var re = new RegExp( "^//", "i" );
t = t.replace( re, "" );
- if ( t.indexOf('..') === 0 || t.indexOf('/..') === 0 ) {
+ if ( t.indexOf('..') === 0 || t.indexOf('/..') === 0 ) {
if ( t.indexOf('/') === 0 ) {
t = t.substr(1,t.length);
}
r = $.map( ret, function(a){ return a.parentNode; } );
t = t.substr(2,t.length);
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 ); } );
t = t.substr(1,t.length);
t = $.cleanSpaces(t);
- } else if ( t.indexOf('+') === 0 ) {
+ } else if ( t.indexOf('+') === 0 ) {
r = $.map( ret, function(a){ return $.sibling(a).next; } );
t = t.substr(1,t.length);
t = $.cleanSpaces(t);
- } else if ( t.indexOf('~') === 0 ) {
+ } else if ( t.indexOf('~') === 0 ) {
r = $.map( ret, function(a){
var r = [];
var s = $.sibling(a);
@@ -502,19 +520,19 @@ $.Select = function( t, context ) {
});
t = t.substr(1,t.length);
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(); }
done = $.merge( done, ret );
r = ret = [context];
t = " " + t.substr(1,t.length);
- } else {
+ } else {
var re2 = new RegExp( "^([#.]?)([a-z0-9\\*_-]*)", "i" );
var m = re2.exec(t);
if ( m[1] == "#" ) { // Ummm, should make this work in all XML docs
var oid = document.getElementById(m[2]);
- r = oid ? [oid] : [];
- t = t.replace( re, "" );
+ r = ret = oid ? [oid] : [];
+ t = t.replace( re2, "" );
} else {
if ( m[2] === "" || m[1] == "." ) { m[2] = "*"; }
@@ -545,18 +563,21 @@ $.Select = function( t, context ) {
}
}
- var val = $.filter(t,r);
- ret = r = val.r;
- t = $.cleanSpaces(val.t);
+ if ( t ) {
+ var val = $.filter(t,r);
+ ret = r = val.r;
+ t = $.cleanSpaces(val.t);
+ }
}
if ( ret && ret[0] == context ) { ret.shift(); }
done = $.merge( done, ret );
+
return done;
};
$.tag = function(a,b){
- return a && typeof a.getElementsByTagName != "undefined" ?
+ return a && a.getElementsByTagName ?
a.getElementsByTagName( b ) : [];
};
@@ -566,7 +587,8 @@ $.attr = function(o,a,v){
'for': 'htmlFor',
'text': 'cssText',
'class': 'className',
- 'float': 'cssFloat'
+ 'float': 'cssFloat',
+ 'style': 'cssText'
};
a = (fix[a] && fix[a].replace && fix[a]) || a;
var r = new RegExp("-([a-z])","ig");
@@ -789,16 +811,14 @@ $.event.handle = function(event) {
}
for ( var i = 0; i < handlers.length; i++ ) {
- try {
- if ( handlers[i].constructor == Function ) {
- this.$$handleEvent = handlers[i];
- if (this.$$handleEvent(event) === false) {
- event.preventDefault();
- event.stopPropagation();
- returnValue = false;
- }
+ if ( handlers[i].constructor == Function ) {
+ this.$$handleEvent = handlers[i];
+ if (this.$$handleEvent(event) === false) {
+ event.preventDefault();
+ event.stopPropagation();
+ returnValue = false;
}
- } catch(e){}
+ }
}
return returnValue;
};