diff options
author | Dan Heberden <danheberden@gmail.com> | 2011-02-15 10:15:46 -0800 |
---|---|---|
committer | Dan Heberden <danheberden@gmail.com> | 2011-02-15 10:15:46 -0800 |
commit | 5c3dc7d48ae501bd52476bfc45905130577d52c9 (patch) | |
tree | 071d9ba0a436524b5f92c261748bf9af0f32f77f /ui | |
parent | 6c3477e12e0bc924aca990eecbb1594433fb9d12 (diff) | |
download | jquery-ui-5c3dc7d48ae501bd52476bfc45905130577d52c9.tar.gz jquery-ui-5c3dc7d48ae501bd52476bfc45905130577d52c9.zip |
Datepicker: prevent datepicker initialization on empty jquery collection and add unit test. Fixed #6976 - datepicker creates extra dom element with empty object
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.datepicker.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js index 6c2e90795..ff6ebad52 100644 --- a/ui/jquery.ui.datepicker.js +++ b/ui/jquery.ui.datepicker.js @@ -1726,7 +1726,12 @@ function isArray(a) { Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ - + + /* Verify an empty collection wasn't passed - Fixes #6976 */ + if ( !this.length ) { + return this; + } + /* Initialise the date picker. */ if (!$.datepicker.initialized) { $(document).mousedown($.datepicker._checkExternalClick). |