diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-03-28 00:52:56 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-03-28 00:52:56 +0000 |
commit | 12b47dc1ea6dfa8c21d2705d02332646e4ff5770 (patch) | |
tree | b623a3e5b1c2a781939b0f137688c8245e0b615b /ui | |
parent | 2b8109e119975155c9965f84c543105530c0812c (diff) | |
download | jquery-ui-12b47dc1ea6dfa8c21d2705d02332646e4ff5770.tar.gz jquery-ui-12b47dc1ea6dfa8c21d2705d02332646e4ff5770.zip |
Widget factory: Fixed $4266 - Add custom selectors for widgets.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.core.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 7c1ea8ca9..d95ec747b 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -217,9 +217,16 @@ function getter(namespace, plugin, method, args) { } $.widget = function(name, prototype) { - var namespace = name.split(".")[0]; + var namespace = name.split(".")[0], + fullName; name = name.split(".")[1]; + fullName = namespace + '-' + name; + // create selector for plugin + $.expr[':'][fullName] = function(elem) { + return !!$.data(elem, name); + }; + // create plugin method $.fn[name] = function(options) { var isMethodCall = (typeof options == 'string'), @@ -259,7 +266,7 @@ $.widget = function(name, prototype) { this.namespace = namespace; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; - this.widgetBaseClass = namespace + '-' + name; + this.widgetBaseClass = fullName; this.options = $.extend(true, {}, $.widget.defaults, |