]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Move data selector from core into its own module
authorAlexander Schmitz <arschmitz@gmail.com>
Wed, 15 Jul 2015 20:43:33 +0000 (16:43 -0400)
committerAlexander Schmitz <arschmitz@gmail.com>
Sat, 8 Aug 2015 04:29:36 +0000 (00:29 -0400)
Ref #9647

tests/unit/core/selector.js
ui/button.js
ui/core.js
ui/data.js [new file with mode: 0644]
ui/draggable.js
ui/sortable.js

index ff4bb064a450b07b0e90ced606874f2321585b9a..14f1de70e49e23f8dd033041f6ef95f395382a8e 100644 (file)
@@ -1,6 +1,7 @@
 define( [
        "jquery",
-       "ui/core"
+       "ui/core",
+       "ui/data"
 ], function( $ ) {
 
 module( "core - selectors" );
index 34228e2da590131270004fe5d44163888347de17..8c9894044f7697658a1a08edb53399a58c1e33b5 100644 (file)
@@ -23,6 +23,7 @@
                define([
                        "jquery",
                        "./core",
+                       "./data",
                        "./version",
                        "./widget"
                ], factory );
index a529f35db55885fe51718882b9f66df950980ee7..6cf599964972828ab82870bf141c220d2dc4ad48 100644 (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 );
        },
diff --git a/ui/data.js b/ui/data.js
new file mode 100644 (file)
index 0000000..e989902
--- /dev/null
@@ -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 ] );
+               }
+} );
+} ) );
index 261be7b489146799711a7133ae4655edffaf17b8..47855e1570f4c2b46716aff3544d41438c3b483c 100644 (file)
@@ -21,8 +21,9 @@
                define([
                        "jquery",
                        "./core",
-                       "./version",
+                       "./data",
                        "./mouse",
+                       "./version",
                        "./widget"
                ], factory );
        } else {
index 0c638906da4ca83a522161ed789348600e783417..8bd267649cdd642d77a56e318ea2eb3a44f6d4ad 100644 (file)
@@ -21,6 +21,7 @@
                define([
                        "jquery",
                        "./core",
+                       "./data",
                        "./mouse",
                        "./version",
                        "./widget"