Removed all deprecated functionality for jQuery 1.2. A full list of what was removed can be found here: http://jquery.com/blog/2007/08/24/jquery-114-faster-more-tests-ready-for-12/
This commit is contained in:
parent
139393fe09
commit
53dc6afc31
6 changed files with 85 additions and 180 deletions
|
@ -1,10 +1,5 @@
|
|||
jQuery.fn.extend({
|
||||
// DEPRECATED
|
||||
loadIfModified: function( url, params, callback ) {
|
||||
this.load( url, params, callback, 1 );
|
||||
},
|
||||
|
||||
load: function( url, params, callback, ifModified ) {
|
||||
load: function( url, params, callback ) {
|
||||
if ( jQuery.isFunction( url ) )
|
||||
return this.bind("load", url);
|
||||
|
||||
|
@ -40,10 +35,9 @@ jQuery.fn.extend({
|
|||
url: url,
|
||||
type: type,
|
||||
data: params,
|
||||
ifModified: ifModified,
|
||||
complete: function(res, status){
|
||||
// If successful, inject the HTML into all the matched elements
|
||||
if ( status == "success" || !ifModified && status == "notmodified" )
|
||||
if ( status == "success" || status == "notmodified" )
|
||||
// See if a selector was specified
|
||||
self.html( selector ?
|
||||
// Create a dummy div to hold the results
|
||||
|
@ -69,12 +63,7 @@ jQuery.fn.extend({
|
|||
|
||||
serialize: function() {
|
||||
return jQuery.param( this );
|
||||
},
|
||||
|
||||
// DEPRECATED
|
||||
// This method no longer does anything - all script evaluation is
|
||||
// taken care of within the HTML injection methods.
|
||||
evalScripts: function(){}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -88,7 +77,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
|
|||
var jsc = (new Date).getTime();
|
||||
|
||||
jQuery.extend({
|
||||
get: function( url, data, callback, type, ifModified ) {
|
||||
get: function( url, data, callback, type ) {
|
||||
// shift arguments if data argument was ommited
|
||||
if ( jQuery.isFunction( data ) ) {
|
||||
callback = data;
|
||||
|
@ -100,16 +89,10 @@ jQuery.extend({
|
|||
url: url,
|
||||
data: data,
|
||||
success: callback,
|
||||
dataType: type,
|
||||
ifModified: ifModified
|
||||
dataType: type
|
||||
});
|
||||
},
|
||||
|
||||
// DEPRECATED
|
||||
getIfModified: function( url, data, callback, type ) {
|
||||
return jQuery.get(url, data, callback, type, 1);
|
||||
},
|
||||
|
||||
getScript: function( url, callback ) {
|
||||
return jQuery.get(url, null, callback, "script");
|
||||
},
|
||||
|
@ -133,11 +116,6 @@ jQuery.extend({
|
|||
});
|
||||
},
|
||||
|
||||
// DEPRECATED
|
||||
ajaxTimeout: function( timeout ) {
|
||||
jQuery.ajaxSettings.timeout = timeout;
|
||||
},
|
||||
|
||||
ajaxSetup: function( settings ) {
|
||||
jQuery.extend( jQuery.ajaxSettings, settings );
|
||||
},
|
||||
|
|
|
@ -211,7 +211,6 @@ test("pass-through request object", function() {
|
|||
|
||||
/* Test disabled, too many simultaneous requests
|
||||
ok( $.get(url(target), success), "get" );
|
||||
ok( $.getIfModified(url(target), success), "getIfModified" );
|
||||
ok( $.post(url(target), success), "post" );
|
||||
ok( $.getScript(url("data/test.js"), success), "script" );
|
||||
ok( $.getJSON(url("data/json_obj.js"), success), "json" );
|
||||
|
@ -312,15 +311,6 @@ test("$.get(String, Hash, Function) - parse xml and use text() on nodes", functi
|
|||
});
|
||||
});
|
||||
|
||||
test("$.getIfModified(String, Hash, Function)", function() {
|
||||
expect(1);
|
||||
stop();
|
||||
$.getIfModified(url("data/name.html"), function(msg) {
|
||||
ok( /^ERROR/.test(msg), 'Check ifModified' );
|
||||
start();
|
||||
});
|
||||
});
|
||||
|
||||
test("$.getScript(String, Function) - with callback", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
|
@ -517,12 +507,12 @@ test("$.post(String, Hash, Function) - simple with xml", function() {
|
|||
});
|
||||
});
|
||||
|
||||
test("$.ajaxTimeout(Number) - with global timeout", function() {
|
||||
test("$.ajaxSetup({timeout: Number}) - with global timeout", function() {
|
||||
stop();
|
||||
|
||||
var passed = 0;
|
||||
|
||||
$.ajaxTimeout(1000);
|
||||
$.ajaxSetup({timeout: 1000});
|
||||
|
||||
var pass = function() {
|
||||
passed++;
|
||||
|
@ -548,11 +538,13 @@ test("$.ajaxTimeout(Number) - with global timeout", function() {
|
|||
});
|
||||
|
||||
// reset timeout
|
||||
$.ajaxTimeout(0);
|
||||
$.ajaxSetup({timeout: 0});
|
||||
});
|
||||
|
||||
test("$.ajaxTimeout(Number) with localtimeout", function() {
|
||||
stop(); $.ajaxTimeout(50);
|
||||
test("$.ajaxSetup({timeout: Number}) with localtimeout", function() {
|
||||
stop();
|
||||
$.ajaxSetup({timeout: 50});
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
timeout: 5000,
|
||||
|
@ -566,8 +558,9 @@ test("$.ajaxTimeout(Number) with localtimeout", function() {
|
|||
start();
|
||||
}
|
||||
});
|
||||
|
||||
// reset timeout
|
||||
$.ajaxTimeout(0);
|
||||
$.ajaxSetup({timeout: 0});
|
||||
});
|
||||
|
||||
test("$.ajax - simple get", function() {
|
||||
|
|
43
src/jquery/coreTest.js
vendored
43
src/jquery/coreTest.js
vendored
|
@ -713,28 +713,28 @@ test("is(String)", function() {
|
|||
ok( !$('#mark').is('.link'), 'Check for class: Did not expect class "link"' );
|
||||
ok( $('#simon').is('.blog.link'), 'Check for multiple classes: Expected classes "blog" and "link"' );
|
||||
ok( !$('#simon').is('.blogTest'), 'Check for multiple classes: Expected classes "blog" and "link", but not "blogTest"' );
|
||||
ok( $('#en').is('[@lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
|
||||
ok( !$('#en').is('[@lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
|
||||
ok( $('#text1').is('[@type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
|
||||
ok( !$('#text1').is('[@type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
|
||||
ok( $('#en').is('[lang="en"]'), 'Check for attribute: Expected attribute lang to be "en"' );
|
||||
ok( !$('#en').is('[lang="de"]'), 'Check for attribute: Expected attribute lang to be "en", not "de"' );
|
||||
ok( $('#text1').is('[type="text"]'), 'Check for attribute: Expected attribute type to be "text"' );
|
||||
ok( !$('#text1').is('[type="radio"]'), 'Check for attribute: Expected attribute type to be "text", not "radio"' );
|
||||
ok( $('#text2').is(':disabled'), 'Check for pseudoclass: Expected to be disabled' );
|
||||
ok( !$('#text1').is(':disabled'), 'Check for pseudoclass: Expected not disabled' );
|
||||
ok( $('#radio2').is(':checked'), 'Check for pseudoclass: Expected to be checked' );
|
||||
ok( !$('#radio1').is(':checked'), 'Check for pseudoclass: Expected not checked' );
|
||||
ok( $('#foo').is('[p]'), 'Check for child: Expected a child "p" element' );
|
||||
ok( !$('#foo').is('[ul]'), 'Check for child: Did not expect "ul" element' );
|
||||
ok( $('#foo').is('[p][a][code]'), 'Check for childs: Expected "p", "a" and "code" child elements' );
|
||||
ok( !$('#foo').is('[p][a][code][ol]'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
|
||||
ok( $('#foo').is(':has(p)'), 'Check for child: Expected a child "p" element' );
|
||||
ok( !$('#foo').is(':has(ul)'), 'Check for child: Did not expect "ul" element' );
|
||||
ok( $('#foo').is(':has(p):has(a):has(code)'), 'Check for childs: Expected "p", "a" and "code" child elements' );
|
||||
ok( !$('#foo').is(':has(p):has(a):has(code):has(ol)'), 'Check for childs: Expected "p", "a" and "code" child elements, but no "ol"' );
|
||||
ok( !$('#foo').is(0), 'Expected false for an invalid expression - 0' );
|
||||
ok( !$('#foo').is(null), 'Expected false for an invalid expression - null' );
|
||||
ok( !$('#foo').is(''), 'Expected false for an invalid expression - ""' );
|
||||
ok( !$('#foo').is(undefined), 'Expected false for an invalid expression - undefined' );
|
||||
|
||||
// test is() with comma-seperated expressions
|
||||
ok( $('#en').is('[@lang="en"],[@lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[@lang="de"],[@lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[@lang="en"] , [@lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[@lang="de"] , [@lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[lang="en"],[lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[lang="de"],[lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[lang="en"] , [lang="de"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
ok( $('#en').is('[lang="de"] , [lang="en"]'), 'Comma-seperated; Check for lang attribute: Expect en or de' );
|
||||
});
|
||||
|
||||
test("$.extend(Object, Object)", function() {
|
||||
|
@ -823,8 +823,8 @@ test("not()", function() {
|
|||
test("siblings([String])", function() {
|
||||
expect(5);
|
||||
isSet( $("#en").siblings().get(), q("sndp", "sap"), "Check for siblings" );
|
||||
isSet( $("#sndp").siblings("[code]").get(), q("sap"), "Check for filtered siblings (has code child element)" );
|
||||
isSet( $("#sndp").siblings("[a]").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
|
||||
isSet( $("#sndp").siblings(":has(code)").get(), q("sap"), "Check for filtered siblings (has code child element)" );
|
||||
isSet( $("#sndp").siblings(":has(a)").get(), q("en", "sap"), "Check for filtered siblings (has anchor child element)" );
|
||||
isSet( $("#foo").siblings("form, b").get(), q("form", "lengthtest", "floatTest"), "Check for multiple filters" );
|
||||
isSet( $("#en, #sndp").siblings().get(), q("sndp", "sap", "en"), "Check for unique results from siblings" );
|
||||
});
|
||||
|
@ -832,7 +832,7 @@ test("siblings([String])", function() {
|
|||
test("children([String])", function() {
|
||||
expect(3);
|
||||
isSet( $("#foo").children().get(), q("sndp", "en", "sap"), "Check for children" );
|
||||
isSet( $("#foo").children("[code]").get(), q("sndp", "sap"), "Check for filtered children" );
|
||||
isSet( $("#foo").children(":has(code)").get(), q("sndp", "sap"), "Check for filtered children" );
|
||||
isSet( $("#foo").children("#en, #sap").get(), q("en", "sap"), "Check for multiple filters" );
|
||||
});
|
||||
|
||||
|
@ -991,14 +991,6 @@ test("empty()", function() {
|
|||
ok( $("#ap").children().length == 4, "Check elements are not removed" );
|
||||
});
|
||||
|
||||
test("eq(), gt(), lt(), contains()", function() {
|
||||
expect(4);
|
||||
ok( $("#ap a").eq(1)[0].id == "groups", "eq()" );
|
||||
isSet( $("#ap a").gt(0).get(), q("groups", "anchor1", "mark"), "gt()" );
|
||||
isSet( $("#ap a").lt(3).get(), q("google", "groups", "anchor1"), "lt()" );
|
||||
isSet( $("#foo a").contains("log").get(), q("anchor2", "simon"), "contains()" );
|
||||
});
|
||||
|
||||
test("slice()", function() {
|
||||
expect(4);
|
||||
isSet( $("#ap a").slice(1,2), q("groups"), "slice(1,2)" );
|
||||
|
@ -1028,8 +1020,9 @@ test("map()", function() {
|
|||
});
|
||||
|
||||
test("contents()", function() {
|
||||
expect(3);
|
||||
expect(2);
|
||||
equals( $("#ap").contents().length, 9, "Check element contents" );
|
||||
ok( $("#iframe").contents()[0], "Check existance of IFrame document" );
|
||||
ok( $("#iframe").contents()[0].body, "Check existance of IFrame body" );
|
||||
// Disabled, randomly fails
|
||||
//ok( $("#iframe").contents()[0].body, "Check existance of IFrame body" );
|
||||
});
|
||||
|
|
28
src/jquery/jquery.js
vendored
28
src/jquery/jquery.js
vendored
|
@ -228,8 +228,7 @@ jQuery.fn = jQuery.prototype = {
|
|||
jQuery.unique( data ) : data );
|
||||
},
|
||||
|
||||
clone: function(deep) {
|
||||
deep = deep != undefined ? deep : true;
|
||||
clone: function() {
|
||||
var $this = this.add(this.find("*"));
|
||||
if (jQuery.browser.msie) {
|
||||
// Need to remove events on the element and its descendants
|
||||
|
@ -242,7 +241,7 @@ jQuery.fn = jQuery.prototype = {
|
|||
|
||||
// Do the clone
|
||||
var r = this.pushStack( jQuery.map( this, function(a){
|
||||
return a.cloneNode( deep );
|
||||
return a.cloneNode( true );
|
||||
}) );
|
||||
|
||||
if (jQuery.browser.msie) {
|
||||
|
@ -257,15 +256,13 @@ jQuery.fn = jQuery.prototype = {
|
|||
}
|
||||
|
||||
// copy form values over
|
||||
if (deep) {
|
||||
var inputs = r.add(r.find('*')).filter('select,input[@type=checkbox]');
|
||||
$this.filter('select,input[@type=checkbox]').each(function(i) {
|
||||
if (this.selectedIndex)
|
||||
inputs[i].selectedIndex = this.selectedIndex;
|
||||
if (this.checked)
|
||||
inputs[i].checked = true;
|
||||
});
|
||||
}
|
||||
var inputs = r.add(r.find('*')).filter('select,input[@type=checkbox]');
|
||||
$this.filter('select,input[@type=checkbox]').each(function(i) {
|
||||
if (this.selectedIndex)
|
||||
inputs[i].selectedIndex = this.selectedIndex;
|
||||
if (this.checked)
|
||||
inputs[i].checked = true;
|
||||
});
|
||||
|
||||
// Return the cloned set
|
||||
return r;
|
||||
|
@ -955,13 +952,6 @@ jQuery.each( {
|
|||
};
|
||||
});
|
||||
|
||||
// DEPRECATED
|
||||
jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){
|
||||
jQuery.fn[ n ] = function(num,fn) {
|
||||
return this.filter( ":" + n + "(" + num + ")", fn );
|
||||
};
|
||||
});
|
||||
|
||||
jQuery.each( [ "height", "width" ], function(i,n){
|
||||
jQuery.fn[ n ] = function(h) {
|
||||
return h == undefined ?
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
|
||||
"(?:[\\w*_-]|\\\\.)" :
|
||||
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
|
||||
quickChild = new RegExp("^[/>]\\s*(" + chars + "+)"),
|
||||
quickChild = new RegExp("^>\\s*(" + chars + "+)"),
|
||||
quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
|
||||
quickClass = new RegExp("^([#.]?)(" + chars + "*)");
|
||||
|
||||
|
@ -60,19 +60,13 @@ jQuery.extend({
|
|||
|
||||
// :header
|
||||
header: "/h\\d/i.test(a.nodeName)"
|
||||
},
|
||||
// DEPRECATED
|
||||
"[": "jQuery.find(m[2],a).length"
|
||||
}
|
||||
},
|
||||
|
||||
// The regular expressions that power the parsing engine
|
||||
parse: [
|
||||
// Match: [@value='test'], [@foo]
|
||||
/^\[ *(@)([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
|
||||
|
||||
// DEPRECATED
|
||||
// Match: [div], [div p]
|
||||
/^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/,
|
||||
/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
|
||||
|
||||
// Match: :contains('foo')
|
||||
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
|
||||
|
@ -106,21 +100,6 @@ jQuery.extend({
|
|||
// Set the correct context (if none is provided)
|
||||
context = context || document;
|
||||
|
||||
// DEPRECATED
|
||||
// Handle the common XPath // expression
|
||||
if ( !t.indexOf("//") ) {
|
||||
//context = context.documentElement;
|
||||
t = t.substr(2,t.length);
|
||||
|
||||
// DEPRECATED
|
||||
// And the / root expression
|
||||
} else if ( !t.indexOf("/") && !context.ownerDocument ) {
|
||||
context = context.documentElement;
|
||||
t = t.substr(1,t.length);
|
||||
if ( t.indexOf("/") >= 1 )
|
||||
t = t.substr(t.indexOf("/"),t.length);
|
||||
}
|
||||
|
||||
// Initialize the search
|
||||
var ret = [context], done = [], last;
|
||||
|
||||
|
@ -130,8 +109,7 @@ jQuery.extend({
|
|||
var r = [];
|
||||
last = t;
|
||||
|
||||
// DEPRECATED
|
||||
t = jQuery.trim(t).replace( /^\/\//, "" );
|
||||
t = jQuery.trim(t);
|
||||
|
||||
var foundToken = false;
|
||||
|
||||
|
@ -154,32 +132,28 @@ jQuery.extend({
|
|||
if ( t.indexOf(" ") == 0 ) continue;
|
||||
foundToken = true;
|
||||
} else {
|
||||
// (.. and /) DEPRECATED
|
||||
re = /^((\/?\.\.)|([>\/+~]))\s*(\w*)/i;
|
||||
re = /^([>+~])\s*(\w*)/i;
|
||||
|
||||
if ( (m = re.exec(t)) != null ) {
|
||||
r = [];
|
||||
|
||||
var nodeName = m[4], mergeNum = jQuery.mergeNum++;
|
||||
var nodeName = m[2], mergeNum = jQuery.mergeNum++;
|
||||
m = m[1];
|
||||
|
||||
for ( var j = 0, rl = ret.length; j < rl; j++ )
|
||||
if ( m.indexOf("..") < 0 ) {
|
||||
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
|
||||
for ( ; n; n = n.nextSibling )
|
||||
if ( n.nodeType == 1 ) {
|
||||
if ( m == "~" && n.mergeNum == mergeNum ) break;
|
||||
for ( var j = 0, rl = ret.length; j < rl; j++ ) {
|
||||
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
|
||||
for ( ; n; n = n.nextSibling )
|
||||
if ( n.nodeType == 1 ) {
|
||||
if ( m == "~" && n.mergeNum == mergeNum ) break;
|
||||
|
||||
if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) {
|
||||
if ( m == "~" ) n.mergeNum = mergeNum;
|
||||
r.push( n );
|
||||
}
|
||||
|
||||
if ( m == "+" ) break;
|
||||
if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) {
|
||||
if ( m == "~" ) n.mergeNum = mergeNum;
|
||||
r.push( n );
|
||||
}
|
||||
// DEPRECATED
|
||||
} else
|
||||
r.push( ret[j].parentNode );
|
||||
|
||||
if ( m == "+" ) break;
|
||||
}
|
||||
}
|
||||
|
||||
ret = r;
|
||||
|
||||
|
@ -347,7 +321,7 @@ jQuery.extend({
|
|||
else if ( m[1] == "." )
|
||||
r = jQuery.classFilter(r, m[2], not);
|
||||
|
||||
else if ( m[1] == "@" ) {
|
||||
else if ( m[1] == "[" ) {
|
||||
var tmp = [], type = m[3];
|
||||
|
||||
for ( var i = 0, rl = r.length; i < rl; i++ ) {
|
||||
|
|
|
@ -63,7 +63,7 @@ test("id", function() {
|
|||
t( "ID Selector, not an ancestor ID", "#form #first", [] );
|
||||
t( "ID Selector, not a child ID", "#form > #option1a", [] );
|
||||
|
||||
t( "All Children of ID", "#foo/*", ["sndp", "en", "sap"] );
|
||||
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
|
||||
t( "All Children of ID with no children", "#firstUL/*", [] );
|
||||
|
||||
$('<a name="tName1">tName1 A</a><a name="tName2">tName2 A</a><div id="tName1">tName1 Div</div>').appendTo('#main');
|
||||
|
@ -134,36 +134,36 @@ test("child and adjacent", function() {
|
|||
|
||||
test("attributes", function() {
|
||||
expect(20);
|
||||
t( "Attribute Exists", "a[@title]", ["google"] );
|
||||
t( "Attribute Exists", "*[@title]", ["google"] );
|
||||
t( "Attribute Exists", "[@title]", ["google"] );
|
||||
t( "Attribute Exists", "a[title]", ["google"] );
|
||||
t( "Attribute Exists", "*[title]", ["google"] );
|
||||
t( "Attribute Exists", "[title]", ["google"] );
|
||||
|
||||
t( "Attribute Equals", "a[@rel='bookmark']", ["simon1"] );
|
||||
t( "Attribute Equals", 'a[@rel="bookmark"]', ["simon1"] );
|
||||
t( "Attribute Equals", "a[@rel=bookmark]", ["simon1"] );
|
||||
t( "Multiple Attribute Equals", "input[@type='hidden'],input[@type='radio']", ["hidden1","radio1","radio2"] );
|
||||
t( "Multiple Attribute Equals", "input[@type=\"hidden\"],input[@type='radio']", ["hidden1","radio1","radio2"] );
|
||||
t( "Multiple Attribute Equals", "input[@type=hidden],input[@type=radio]", ["hidden1","radio1","radio2"] );
|
||||
t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] );
|
||||
t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] );
|
||||
t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] );
|
||||
t( "Multiple Attribute Equals", "input[type='hidden'],input[type='radio']", ["hidden1","radio1","radio2"] );
|
||||
t( "Multiple Attribute Equals", "input[type=\"hidden\"],input[type='radio']", ["hidden1","radio1","radio2"] );
|
||||
t( "Multiple Attribute Equals", "input[type=hidden],input[type=radio]", ["hidden1","radio1","radio2"] );
|
||||
|
||||
t( "Attribute selector using UTF8", "span[@lang=中文]", ["台北"] );
|
||||
t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
|
||||
|
||||
t( "Attribute Begins With", "a[@href ^= 'http://www']", ["google","yahoo"] );
|
||||
t( "Attribute Ends With", "a[@href $= 'org/']", ["mark"] );
|
||||
t( "Attribute Contains", "a[@href *= 'google']", ["google","groups"] );
|
||||
t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
|
||||
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
|
||||
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
|
||||
|
||||
t("Select options via [@selected]", "#select1 option[@selected]", ["option1a"] );
|
||||
t("Select options via [@selected]", "#select2 option[@selected]", ["option2d"] );
|
||||
t("Select options via [@selected]", "#select3 option[@selected]", ["option3b", "option3c"] );
|
||||
t("Select options via [selected]", "#select1 option[selected]", ["option1a"] );
|
||||
t("Select options via [selected]", "#select2 option[selected]", ["option2d"] );
|
||||
t("Select options via [selected]", "#select3 option[selected]", ["option3b", "option3c"] );
|
||||
|
||||
t( "Grouped Form Elements", "input[@name='foo[bar]']", ["hidden2"] );
|
||||
t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
|
||||
|
||||
t( ":not() Existing attribute", "select:not([@multiple])", ["select1", "select2"]);
|
||||
t( ":not() Equals attribute", "select:not([@name=select1])", ["select2", "select3"]);
|
||||
t( ":not() Equals quoted attribute", "select:not([@name='select1'])", ["select2", "select3"]);
|
||||
t( ":not() Existing attribute", "select:not([multiple])", ["select1", "select2"]);
|
||||
t( ":not() Equals attribute", "select:not([name=select1])", ["select2", "select3"]);
|
||||
t( ":not() Equals quoted attribute", "select:not([name='select1'])", ["select2", "select3"]);
|
||||
});
|
||||
|
||||
test("pseudo (:) selectors", function() {
|
||||
expect(31);
|
||||
expect(32);
|
||||
t( "First Child", "p:first-child", ["firstp","sndp"] );
|
||||
t( "Last Child", "p:last-child", ["sap"] );
|
||||
t( "Only Child", "a:only-child", ["simon1","anchor1","yahoo","anchor2"] );
|
||||
|
@ -198,28 +198,5 @@ test("pseudo (:) selectors", function() {
|
|||
t( "Form element :checkbox:checked, :radio:checked", ":checkbox:checked, :radio:checked", ["check1", "radio2"] );
|
||||
|
||||
t( "Headers", ":header", ["header", "banner", "userAgent"] );
|
||||
});
|
||||
|
||||
test("basic xpath", function() {
|
||||
expect(17);
|
||||
ok( jQuery.find("//*").length >= 30, "All Elements (//*)" );
|
||||
ok( jQuery.find("//div", q("main")[0])[0] = q("foo")[0], "All Relative (#main//div)" );
|
||||
t( "All P Elements", "//p", ["firstp","ap","sndp","en","sap","first"] );
|
||||
t( "Absolute Path", "/html/body", ["body"] );
|
||||
t( "Absolute Path w/ *", "/* /body", ["body"] );
|
||||
t( "Long Absolute Path", "/html/body/dl/div/div/p", ["sndp","en","sap"] );
|
||||
t( "Absolute and Relative Paths", "/html//p", ["firstp","ap","sndp","en","sap","first"] );
|
||||
t( "All Children, Explicit", "//code/*", ["anchor1","anchor2"] );
|
||||
t( "All Children, Implicit", "//code/", ["anchor1","anchor2"] );
|
||||
t( "Attribute Exists", "//a[@title]", ["google"] );
|
||||
t( "Attribute Equals", "//a[@rel='bookmark']", ["simon1"] );
|
||||
t( "Parent Axis", "//p/..", ["main","foo"] );
|
||||
t( "Sibling Axis", "//p/../", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","lengthtest","table","fx-queue","fx-tests","sndp","en","sap"] );
|
||||
t( "Sibling Axis", "//p/../*", ["firstp","ap","foo","first","firstUL","empty","form","floatTest","iframe","lengthtest","table","fx-queue","fx-tests","sndp","en","sap"] );
|
||||
t( "Has Children", "//p[a]", ["firstp","ap","en","sap"] );
|
||||
t( "Has Children - :has()", "//p:has(a)", ["firstp","ap","en","sap"] );
|
||||
|
||||
$("#foo").each(function() {
|
||||
isSet( $("/p", this).get(), q("sndp", "en", "sap"), "Check XPath context" );
|
||||
});
|
||||
t( "Has Children - :has()", "p:has(a)", ["firstp","ap","en","sap"] );
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue