X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=7a59a4ea6db6a25d763b6b3b3e3fae71ae56b403;hb=e7669f64d88612884df27c5744558191f8e6c8b1;hp=9965fd3497389042ecb6c25f8c705f9eb26ac56e;hpb=6de5a6b96a72f7b0b2cc54fa7df5410664b6e18b;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 9965fd3..7a59a4e 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -50,8 +50,10 @@ jQuery = function(a,c) { return new jQuery(a,c); // Handle HTML strings - var m = /^[^<]*(<.+>)[^>]*$/.exec(a); - if ( m ) a = jQuery.clean( [ m[1] ] ); + if ( a.constructor == String ) { + var m = /^[^<]*(<.+>)[^>]*$/.exec(a); + if ( m ) a = jQuery.clean( [ m[1] ] ); + } // Watch for when an array is passed in this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ? @@ -446,6 +448,17 @@ jQuery.fn = jQuery.prototype = { * $("#check2").attr('checked', false); * ok( document.getElementById('check2').checked == false, 'Set checked attribute' ); * + * @test stop(); + * $.get('data/dashboard.xml', function(xml) { + * var titles = []; + * $('tab', xml).each(function() { + * titles.push($(this).attr('title')); + * }); + * ok( titles[0] == 'Location', 'attr() in XML context: Check first title' ); + * ok( titles[1] == 'Users', 'attr() in XML context: Check second title' ); + * start(); + * }); + * * @name attr * @type jQuery * @param String key The name of the property to set. @@ -1374,7 +1387,7 @@ jQuery.extend({ fn.apply( obj[i], args || [i, obj[i]] ); else for ( var i = 0; i < obj.length; i++ ) - fn.apply( obj[i], args || [i, obj[i]] ); + if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break; return obj; }, @@ -1558,7 +1571,7 @@ jQuery.extend({ empty: "!a.childNodes.length", // Text Check - contains: "(a.innerText||a.innerHTML).indexOf(m[3])>=0", + contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0", // Visibility visible: "a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'", @@ -1648,9 +1661,9 @@ jQuery.extend({ * t( "Attribute Exists", "*[@title]", ["google"] ); * t( "Attribute Exists", "[@title]", ["google"] ); * - * t( "Non-existing part of attribute [@name*=bla]", "[@name*=bla]", [] ); - * t( "Non-existing start of attribute [@name^=bla]", "[@name^=bla]", [] ); - * t( "Non-existing end of attribute [@name$=bla]", "[@name$=bla]", [] ); + * t( "Non-existing part of attribute", "[@name*=bla]", [] ); + * t( "Non-existing start of attribute", "[@name^=bla]", [] ); + * t( "Non-existing end of attribute", "[@name$=bla]", [] ); * * t( "Attribute Equals", "a[@rel='bookmark']", ["simon1"] ); * t( "Attribute Equals", 'a[@rel="bookmark"]', ["simon1"] ); @@ -1859,7 +1872,7 @@ jQuery.extend({ return elem.getAttributeNode(name).nodeValue; } else if ( elem.getAttribute != undefined && elem.tagName ) { // IE elem.getAttribute passes even for style if ( value != undefined ) elem.setAttribute( name, value ); - return elem.getAttribute( name, 2 ); + return elem.getAttribute( name ); } else { name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();}); if ( value != undefined ) elem[name] = value; @@ -2681,7 +2694,7 @@ jQuery.macros = { /** * Set the value of every matched element. * - * @example $("input").value("test"); + * @example $("input").val("test"); * @before * @result *