aboutsummaryrefslogtreecommitdiffstats
path: root/ui/data.js
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2015-07-15 16:43:33 -0400
committerAlexander Schmitz <arschmitz@gmail.com>2015-08-08 00:29:36 -0400
commitf0260fd91b593ae56f68e1f33ca8496c1c4b0467 (patch)
tree2a68e32188b4a9c81ed37820232feaeae11a797a /ui/data.js
parent3d71fb83fe02a307823594f5905be9848cfa5506 (diff)
downloadjquery-ui-f0260fd91b593ae56f68e1f33ca8496c1c4b0467.tar.gz
jquery-ui-f0260fd91b593ae56f68e1f33ca8496c1c4b0467.zip
Core: Move data selector from core into its own module
Ref #9647
Diffstat (limited to 'ui/data.js')
-rw-r--r--ui/data.js38
1 files changed, 38 insertions, 0 deletions
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 ] );
+ }
+} );
+} ) );