From: Alexander Schmitz Date: Wed, 15 Jul 2015 20:43:33 +0000 (-0400) Subject: Core: Move data selector from core into its own module X-Git-Tag: 1.12.0-beta.1~229 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f0260fd91b593ae56f68e1f33ca8496c1c4b0467;p=jquery-ui.git Core: Move data selector from core into its own module Ref #9647 --- diff --git a/tests/unit/core/selector.js b/tests/unit/core/selector.js index ff4bb064a..14f1de70e 100644 --- a/tests/unit/core/selector.js +++ b/tests/unit/core/selector.js @@ -1,6 +1,7 @@ define( [ "jquery", - "ui/core" + "ui/core", + "ui/data" ], function( $ ) { module( "core - selectors" ); diff --git a/ui/button.js b/ui/button.js index 34228e2da..8c9894044 100644 --- a/ui/button.js +++ b/ui/button.js @@ -23,6 +23,7 @@ define([ "jquery", "./core", + "./data", "./version", "./widget" ], factory ); diff --git a/ui/core.js b/ui/core.js index a529f35db..6cf599964 100644 --- a/ui/core.js +++ b/ui/core.js @@ -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 index 000000000..e989902da --- /dev/null +++ b/ui/data.js @@ -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 ] ); + } +} ); +} ) ); diff --git a/ui/draggable.js b/ui/draggable.js index 261be7b48..47855e157 100644 --- a/ui/draggable.js +++ b/ui/draggable.js @@ -21,8 +21,9 @@ define([ "jquery", "./core", - "./version", + "./data", "./mouse", + "./version", "./widget" ], factory ); } else { diff --git a/ui/sortable.js b/ui/sortable.js index 0c638906d..8bd267649 100644 --- a/ui/sortable.js +++ b/ui/sortable.js @@ -21,6 +21,7 @@ define([ "jquery", "./core", + "./data", "./mouse", "./version", "./widget"