Core: Move data selector from core into its own module

Ref #9647
This commit is contained in:
Alexander Schmitz 2015-07-15 16:43:33 -04:00
parent 3d71fb83fe
commit f0260fd91b
6 changed files with 45 additions and 13 deletions

View File

@ -1,6 +1,7 @@
define( [
"jquery",
"ui/core"
"ui/core",
"ui/data"
], function( $ ) {
module( "core - selectors" );

View File

@ -23,6 +23,7 @@
define([
"jquery",
"./core",
"./data",
"./version",
"./widget"
], factory );

View File

@ -20,6 +20,7 @@
// AMD. Register as an anonymous module.
define( [
"jquery",
"./data",
"./version" ], factory );
} else {
@ -207,17 +208,6 @@ function visible( element ) {
}
$.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
} ) :
// support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
},
focusable: function( element ) {
return focusable( element, $.attr( element, "tabindex" ) != null );
},

38
ui/data.js Normal file
View File

@ -0,0 +1,38 @@
/*!
* jQuery UI :data @VERSION
* http://jqueryui.com
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
//>>label: :data
//>>group: Core
//>>description: Selects elements which have data stored under the specified key.
//>>docs: http://api.jqueryui.com/data-selector/
( function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define( [ "jquery", "./version" ], factory );
} else {
// Browser globals
factory( jQuery );
}
} ( function( $ ) {
return $.extend( $.expr[ ":" ], {
data: $.expr.createPseudo ?
$.expr.createPseudo( function( dataName ) {
return function( elem ) {
return !!$.data( elem, dataName );
};
} ) :
// support: jQuery <1.8
function( elem, i, match ) {
return !!$.data( elem, match[ 3 ] );
}
} );
} ) );

View File

@ -21,8 +21,9 @@
define([
"jquery",
"./core",
"./version",
"./data",
"./mouse",
"./version",
"./widget"
], factory );
} else {

View File

@ -21,6 +21,7 @@
define([
"jquery",
"./core",
"./data",
"./mouse",
"./version",
"./widget"