diff options
author | Felix Nagel <info@felixnagel.com> | 2013-06-24 20:28:10 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-06-24 20:28:10 +0200 |
commit | 9992d4626eca1182c9688190ff5642168f2490ec (patch) | |
tree | 41bc8629a8c8e3c133bfe4de4fae1da1d6202f90 | |
parent | ab72fd16667cf08cadc0bf8b3375622b0d74d81a (diff) | |
parent | fe9f6ca98634dd82c3cdb907d725c42f97afe951 (diff) | |
download | jquery-ui-9992d4626eca1182c9688190ff5642168f2490ec.tar.gz jquery-ui-9992d4626eca1182c9688190ff5642168f2490ec.zip |
Merge branch 'master' into selectmenu
50 files changed, 389 insertions, 387 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..60bbd484c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - "0.8" +before_script: + - npm install -g grunt-cli
\ No newline at end of file diff --git a/AUTHORS.txt b/AUTHORS.txt index fae527dae..6817f2308 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -243,3 +243,8 @@ Zaven Muradyan <megalivoithos@gmail.com> Woody Gilk <shadowhand@deviantart.com> Zbigniew Motyka <zbigniew.motyka@gmail.com> Suhail Alkowaileet <xsoh.k7@gmail.com> +Toshi MARUYAMA <marutosijp2@yahoo.co.jp> +David Hansen <hansede@gmail.com> +Brian Grinstead <briangrinstead@gmail.com> +Christian Klammer <christian314159@gmail.com> +Steven Luscher <jquerycla@steveluscher.com> diff --git a/build/effect.json b/build/effect.json index 7119f85bc..07e047f03 100644 --- a/build/effect.json +++ b/build/effect.json @@ -23,15 +23,23 @@ "highlight": { "description": "Highlights the background of an element in a defined color for a custom duration." }, + "puff": { + "dependencies": [ "effect-scale" ], + "description": "Creates a puff effect by scaling the element up and hiding it at the same time." + }, "pulsate": { "description": "Pulsates an element n times by changing the opacity to zero and back." }, "scale": { + "dependencies": [ "effect-size" ], "description": "Grows or shrinks an element and its content. Restores an elemnt to its original size." }, "shake": { "description": "Shakes an element horizontally or vertically n times." }, + "size": { + "description": "Resize an element to a specified width and height." + }, "slide": { "description": "Slides an element in and out of the viewport." } diff --git a/demos/addClass/index.html b/demos/addClass/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/addClass/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/animate/index.html b/demos/animate/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/animate/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/addClass/default.html b/demos/effect/addClass.html index 97a06a293..97a06a293 100644 --- a/demos/addClass/default.html +++ b/demos/effect/addClass.html diff --git a/demos/animate/default.html b/demos/effect/animate.html index 4095cee73..4095cee73 100644 --- a/demos/animate/default.html +++ b/demos/effect/animate.html diff --git a/demos/effect/default.html b/demos/effect/default.html index 7c3d05f14..52282ea57 100644 --- a/demos/effect/default.html +++ b/demos/effect/default.html @@ -14,9 +14,11 @@ <script src="../../ui/jquery.ui.effect-fade.js"></script> <script src="../../ui/jquery.ui.effect-fold.js"></script> <script src="../../ui/jquery.ui.effect-highlight.js"></script> + <script src="../../ui/jquery.ui.effect-puff.js"></script> <script src="../../ui/jquery.ui.effect-pulsate.js"></script> <script src="../../ui/jquery.ui.effect-scale.js"></script> <script src="../../ui/jquery.ui.effect-shake.js"></script> + <script src="../../ui/jquery.ui.effect-size.js"></script> <script src="../../ui/jquery.ui.effect-slide.js"></script> <script src="../../ui/jquery.ui.effect-transfer.js"></script> <link rel="stylesheet" href="../demos.css"> diff --git a/demos/hide/default.html b/demos/effect/hide.html index fc8182ecb..fc8182ecb 100644 --- a/demos/hide/default.html +++ b/demos/effect/hide.html diff --git a/demos/effect/index.html b/demos/effect/index.html index 5da6bc612..dd1d229ac 100644 --- a/demos/effect/index.html +++ b/demos/effect/index.html @@ -9,6 +9,14 @@ <ul> <li><a href="default.html">Effect showcase</a></li> <li><a href="easing.html">Easing showcase</a></li> + <li><a href="addClass.html">.addClass()</a></li> + <li><a href="animate.html">.animate()</a></li> + <li><a href="hide.html">.hide()</a></li> + <li><a href="removeClass.html">.removeClass()</a></li> + <li><a href="show.html">.show()</a></li> + <li><a href="switchClass.html">.switchClass()</a></li> + <li><a href="toggle.html">.toggle()</a></li> + <li><a href="toggleClass.html">.toggleClass()</a></li> </ul> </body> diff --git a/demos/removeClass/default.html b/demos/effect/removeClass.html index 74348c7a3..74348c7a3 100644 --- a/demos/removeClass/default.html +++ b/demos/effect/removeClass.html diff --git a/demos/show/default.html b/demos/effect/show.html index 599a625f0..599a625f0 100644 --- a/demos/show/default.html +++ b/demos/effect/show.html diff --git a/demos/switchClass/default.html b/demos/effect/switchClass.html index e4bd3b4f2..e4bd3b4f2 100644 --- a/demos/switchClass/default.html +++ b/demos/effect/switchClass.html diff --git a/demos/toggle/default.html b/demos/effect/toggle.html index 354393917..354393917 100644 --- a/demos/toggle/default.html +++ b/demos/effect/toggle.html diff --git a/demos/toggleClass/default.html b/demos/effect/toggleClass.html index 93ab10a1d..93ab10a1d 100644 --- a/demos/toggleClass/default.html +++ b/demos/effect/toggleClass.html diff --git a/demos/hide/index.html b/demos/hide/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/hide/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/removeClass/index.html b/demos/removeClass/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/removeClass/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/show/index.html b/demos/show/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/show/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/switchClass/index.html b/demos/switchClass/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/switchClass/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/toggle/index.html b/demos/toggle/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/toggle/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/demos/toggleClass/index.html b/demos/toggleClass/index.html deleted file mode 100644 index 3620fd7c5..000000000 --- a/demos/toggleClass/index.html +++ /dev/null @@ -1,14 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>jQuery UI Effects Demos</title> -</head> -<body> - -<ul> - <li><a href="default.html">Default functionality</a></li> -</ul> - -</body> -</html> diff --git a/package.json b/package.json index b74d1397e..b561295b1 100644 --- a/package.json +++ b/package.json @@ -51,10 +51,13 @@ "url": "https://github.com/jquery/jquery-ui/blob/master/MIT-LICENSE.txt" } ], + "scripts": { + "test": "grunt" + }, "dependencies": {}, "devDependencies": { "grunt": "0.4.1", - "grunt-contrib-jshint": "0.4.1", + "grunt-contrib-jshint": "0.6.0", "grunt-contrib-uglify": "0.1.1", "grunt-contrib-concat": "0.1.3", "grunt-contrib-qunit": "0.2.0", diff --git a/tests/unit/datepicker/datepicker_test_helpers.js b/tests/unit/datepicker/datepicker_test_helpers.js index 9cb63c9ec..34b41bbc6 100644 --- a/tests/unit/datepicker/datepicker_test_helpers.js +++ b/tests/unit/datepicker/datepicker_test_helpers.js @@ -22,16 +22,6 @@ TestHelpers.datepicker = { var id = $( "<input>" ).appendTo( "#qunit-fixture" ); return TestHelpers.datepicker.init( id, options ); }, - onFocus: function( element, onFocus ) { - var fn = function( event ){ - if( !event.originalEvent ) { - return; - } - element.unbind( "focus", fn ); - onFocus(); - }; - - element.bind( "focus", fn )[ 0 ].focus(); - }, + onFocus: TestHelpers.onFocus, PROP_NAME: "datepicker" };
\ No newline at end of file diff --git a/tests/unit/draggable/draggable_core.js b/tests/unit/draggable/draggable_core.js index e2dc2a481..69906b6a7 100644 --- a/tests/unit/draggable/draggable_core.js +++ b/tests/unit/draggable/draggable_core.js @@ -185,4 +185,34 @@ test( "#5727: draggable from iframe" , function() { TestHelpers.draggable.shouldMove( draggable1 ); }); +test( "#8399: A draggable should become the active element after you are finished interacting with it, but not before.", function() { + expect( 2 ); + + var element = $( "<a href='#'>link</a>" ).appendTo( "#qunit-fixture" ).draggable(); + + $( document ).one( "mousemove", function() { + notStrictEqual( document.activeElement, element.get( 0 ), "moving a draggable anchor did not make it the active element" ); + }); + + TestHelpers.draggable.move( element, 50, 50 ); + + strictEqual( document.activeElement, element.get( 0 ), "finishing moving a draggable anchor made it the active element" ); +}); + +asyncTest( "#4261: active element should blur when mousing down on a draggable", function() { + expect( 2 ); + + var textInput = $( "<input>" ).appendTo( "#qunit-fixture" ), + element = $( "#draggable1" ).draggable(); + + TestHelpers.onFocus( textInput, function() { + strictEqual( document.activeElement, textInput.get( 0 ), "ensure that a focussed text input is the active element before mousing down on a draggable" ); + + TestHelpers.draggable.move( element, 50, 50 ); + + notStrictEqual( document.activeElement, textInput.get( 0 ), "ensure the text input is no longer the active element after mousing down on a draggable" ); + start(); + }); +}); + })( jQuery ); diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html index 4538ecb03..f35393b89 100644 --- a/tests/unit/effects/effects.html +++ b/tests/unit/effects/effects.html @@ -21,9 +21,11 @@ "ui/jquery.ui.effect-fade.js", "ui/jquery.ui.effect-fold.js", "ui/jquery.ui.effect-highlight.js", + "ui/jquery.ui.effect-puff.js", "ui/jquery.ui.effect-pulsate.js", "ui/jquery.ui.effect-scale.js", "ui/jquery.ui.effect-shake.js", + "ui/jquery.ui.effect-size.js", "ui/jquery.ui.effect-slide.js", "ui/jquery.ui.effect-transfer.js" ] diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js index 11e9d0b45..05db494e6 100644 --- a/tests/unit/effects/effects_core.js +++ b/tests/unit/effects/effects_core.js @@ -217,10 +217,7 @@ asyncTest( "animateClass: css and class changes during animation are not lost (# $.each( $.effects.effect, function( effect ) { module( "effects." + effect ); - // puff and size are defined inside scale - if ( effect !== "puff" && effect !== "size" ) { - TestHelpers.testJshint( "effect-" + effect ); - } + TestHelpers.testJshint( "effect-" + effect ); if ( effect === "transfer" ) { return; diff --git a/tests/unit/menu/menu_methods.js b/tests/unit/menu/menu_methods.js index c51d123c2..063fbf0b7 100644 --- a/tests/unit/menu/menu_methods.js +++ b/tests/unit/menu/menu_methods.js @@ -69,6 +69,19 @@ test( "refresh submenu", function() { equal( element.find( "ul:first .ui-menu-item" ).length, 4 ); }); +test( "refresh icons (see #9377)", function() { + expect( 3 ); + var element = $( "#menu1" ).menu(); + ok( !element.hasClass( "ui-menu-icons") ); + element.find( "li:first a" ).html( "<span class='ui-icon ui-icon-disk'></span>Save</a>" ); + element.menu( "refresh" ); + + ok( element.hasClass( "ui-menu-icons" ) ); + element.find( "li:first a" ).html( "Save" ); + element.menu( "refresh" ); + ok( !element.hasClass( "ui-menu-icons") ); +}); + test( "widget", function() { expect( 2 ); var element = $( "#menu1" ).menu(), diff --git a/tests/unit/testsuite.js b/tests/unit/testsuite.js index ddc59ed08..6e840f415 100644 --- a/tests/unit/testsuite.js +++ b/tests/unit/testsuite.js @@ -175,6 +175,18 @@ TestHelpers.commonWidgetTests = function( widget, settings ) { }); }; +TestHelpers.onFocus= function( element, onFocus ) { + var fn = function( event ){ + if( !event.originalEvent ) { + return; + } + element.unbind( "focus", fn ); + onFocus(); + }; + + element.bind( "focus", fn )[ 0 ].focus(); +}; + /* * Taken from https://github.com/jquery/qunit/tree/master/addons/close-enough */ diff --git a/themes/base/jquery.ui.accordion.css b/themes/base/jquery.ui.accordion.css index dba1fd328..56ff2af5c 100644 --- a/themes/base/jquery.ui.accordion.css +++ b/themes/base/jquery.ui.accordion.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Accordion#theming + * http://api.jqueryui.com/accordion/#theming */ .ui-accordion .ui-accordion-header { display: block; diff --git a/themes/base/jquery.ui.all.css b/themes/base/jquery.ui.all.css index f054b9226..6d4d3d83b 100644 --- a/themes/base/jquery.ui.all.css +++ b/themes/base/jquery.ui.all.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Theming + * http://api.jqueryui.com/category/theming/ */ @import "jquery.ui.base.css"; @import "jquery.ui.theme.css"; diff --git a/themes/base/jquery.ui.autocomplete.css b/themes/base/jquery.ui.autocomplete.css index 17ebe17a7..665ba5d41 100644 --- a/themes/base/jquery.ui.autocomplete.css +++ b/themes/base/jquery.ui.autocomplete.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Autocomplete#theming + * http://api.jqueryui.com/autocomplete/#theming */ .ui-autocomplete { position: absolute; diff --git a/themes/base/jquery.ui.base.css b/themes/base/jquery.ui.base.css index 752dd9715..aefa81de4 100644 --- a/themes/base/jquery.ui.base.css +++ b/themes/base/jquery.ui.base.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Theming + * http://api.jqueryui.com/category/theming/ */ @import url("jquery.ui.core.css"); diff --git a/themes/base/jquery.ui.button.css b/themes/base/jquery.ui.button.css index 57b4fc889..d2af0f4ad 100644 --- a/themes/base/jquery.ui.button.css +++ b/themes/base/jquery.ui.button.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Button#theming + * http://api.jqueryui.com/button/#theming */ .ui-button { display: inline-block; diff --git a/themes/base/jquery.ui.core.css b/themes/base/jquery.ui.core.css index c644bb30f..0c70001ba 100644 --- a/themes/base/jquery.ui.core.css +++ b/themes/base/jquery.ui.core.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Theming/API + * http://api.jqueryui.com/category/theming/ */ /* Layout helpers diff --git a/themes/base/jquery.ui.datepicker.css b/themes/base/jquery.ui.datepicker.css index 224924e27..9538bce8f 100644 --- a/themes/base/jquery.ui.datepicker.css +++ b/themes/base/jquery.ui.datepicker.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Datepicker#theming + * http://api.jqueryui.com/datepicker/#theming */ .ui-datepicker { width: 17em; diff --git a/themes/base/jquery.ui.dialog.css b/themes/base/jquery.ui.dialog.css index 35dfb6096..c5499d8db 100644 --- a/themes/base/jquery.ui.dialog.css +++ b/themes/base/jquery.ui.dialog.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Dialog#theming + * http://api.jqueryui.com/dialog/#theming */ .ui-dialog { position: absolute; diff --git a/themes/base/jquery.ui.menu.css b/themes/base/jquery.ui.menu.css index 8eda1e16e..8a61d1b69 100644 --- a/themes/base/jquery.ui.menu.css +++ b/themes/base/jquery.ui.menu.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Menu#theming + * http://api.jqueryui.com/menu/#theming */ .ui-menu { list-style: none; diff --git a/themes/base/jquery.ui.progressbar.css b/themes/base/jquery.ui.progressbar.css index b0630bed1..dd1a2842e 100644 --- a/themes/base/jquery.ui.progressbar.css +++ b/themes/base/jquery.ui.progressbar.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Progressbar#theming + * http://api.jqueryui.com/progressbar/#theming */ .ui-progressbar { height: 2em; diff --git a/themes/base/jquery.ui.resizable.css b/themes/base/jquery.ui.resizable.css index 054fa7b88..f0f8c474d 100644 --- a/themes/base/jquery.ui.resizable.css +++ b/themes/base/jquery.ui.resizable.css @@ -5,8 +5,6 @@ * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming */ .ui-resizable { position: relative; diff --git a/themes/base/jquery.ui.selectable.css b/themes/base/jquery.ui.selectable.css index e9a48dcaa..d44ad46cf 100644 --- a/themes/base/jquery.ui.selectable.css +++ b/themes/base/jquery.ui.selectable.css @@ -5,8 +5,6 @@ * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming */ .ui-selectable-helper { position: absolute; diff --git a/themes/base/jquery.ui.slider.css b/themes/base/jquery.ui.slider.css index 320eed060..b6b68b8b0 100644 --- a/themes/base/jquery.ui.slider.css +++ b/themes/base/jquery.ui.slider.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Slider#theming + * http://api.jqueryui.com/slider/#theming */ .ui-slider { position: relative; diff --git a/themes/base/jquery.ui.spinner.css b/themes/base/jquery.ui.spinner.css index db05c520b..24fc29f32 100644 --- a/themes/base/jquery.ui.spinner.css +++ b/themes/base/jquery.ui.spinner.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Spinner#theming + * http://api.jqueryui.com/spinner/#theming */ .ui-spinner { position: relative; diff --git a/themes/base/jquery.ui.tabs.css b/themes/base/jquery.ui.tabs.css index 4994f210a..827300246 100644 --- a/themes/base/jquery.ui.tabs.css +++ b/themes/base/jquery.ui.tabs.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Tabs#theming + * http://api.jqueryui.com/tabs/#theming */ .ui-tabs { position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ diff --git a/themes/base/jquery.ui.theme.css b/themes/base/jquery.ui.theme.css index fd586d90b..2c3004392 100644 --- a/themes/base/jquery.ui.theme.css +++ b/themes/base/jquery.ui.theme.css @@ -6,7 +6,7 @@ * Released under the MIT license. * http://jquery.org/license * - * http://docs.jquery.com/UI/Theming/API + * http://api.jqueryui.com/category/theming/ * * To view and modify this theme, visit http://jqueryui.com/themeroller/ */ diff --git a/themes/base/jquery.ui.tooltip.css b/themes/base/jquery.ui.tooltip.css index a2702ad6c..b4799ef56 100644 --- a/themes/base/jquery.ui.tooltip.css +++ b/themes/base/jquery.ui.tooltip.css @@ -5,6 +5,8 @@ * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license + * + * http://api.jqueryui.com/tooltip/#theming */ .ui-tooltip { padding: 8px; diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index bf90d349b..ab1e800cd 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -78,6 +78,8 @@ $.widget("ui.draggable", $.ui.mouse, { var o = this.options; + $( document.activeElement ).blur(); + // among others, prevent a drag on a resizable-handle if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { return false; @@ -263,6 +265,9 @@ $.widget("ui.draggable", $.ui.mouse, { $.ui.ddmanager.dragStop(this, event); } + // The interaction is over; whether or not the click resulted in a drag, focus the element + this.element.focus(); + return $.ui.mouse.prototype._mouseUp.call(this, event); }, diff --git a/ui/jquery.ui.effect-puff.js b/ui/jquery.ui.effect-puff.js new file mode 100644 index 000000000..a910defb2 --- /dev/null +++ b/ui/jquery.ui.effect-puff.js @@ -0,0 +1,50 @@ +/*! + * jQuery UI Effects Puff @VERSION + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/puff-effect/ + * + * Depends: + * jquery.ui.effect.js + * jquery.ui.effect-scale.js + */ +(function( $, undefined ) { + +$.effects.effect.puff = function( o, done ) { + var elem = $( this ), + mode = $.effects.setMode( elem, o.mode || "hide" ), + hide = mode === "hide", + percent = parseInt( o.percent, 10 ) || 150, + factor = percent / 100, + original = { + height: elem.height(), + width: elem.width(), + outerHeight: elem.outerHeight(), + outerWidth: elem.outerWidth() + }; + + $.extend( o, { + effect: "scale", + queue: false, + fade: true, + mode: mode, + complete: done, + percent: hide ? percent : 100, + from: hide ? + original : + { + height: original.height * factor, + width: original.width * factor, + outerHeight: original.outerHeight * factor, + outerWidth: original.outerWidth * factor + } + }); + + elem.effect( o ); +}; + +})(jQuery); diff --git a/ui/jquery.ui.effect-scale.js b/ui/jquery.ui.effect-scale.js index 710ad2807..a1fc4e247 100644 --- a/ui/jquery.ui.effect-scale.js +++ b/ui/jquery.ui.effect-scale.js @@ -10,42 +10,10 @@ * * Depends: * jquery.ui.effect.js + * jquery.ui.effect-size.js */ (function( $, undefined ) { -$.effects.effect.puff = function( o, done ) { - var elem = $( this ), - mode = $.effects.setMode( elem, o.mode || "hide" ), - hide = mode === "hide", - percent = parseInt( o.percent, 10 ) || 150, - factor = percent / 100, - original = { - height: elem.height(), - width: elem.width(), - outerHeight: elem.outerHeight(), - outerWidth: elem.outerWidth() - }; - - $.extend( o, { - effect: "scale", - queue: false, - fade: true, - mode: mode, - complete: done, - percent: hide ? percent : 100, - from: hide ? - original : - { - height: original.height * factor, - width: original.width * factor, - outerHeight: original.outerHeight * factor, - outerWidth: original.outerWidth * factor - } - }); - - elem.effect( o ); -}; - $.effects.effect.scale = function( o, done ) { // Create element @@ -108,211 +76,4 @@ $.effects.effect.scale = function( o, done ) { }; -$.effects.effect.size = function( o, done ) { - - // Create element - var original, baseline, factor, - el = $( this ), - props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], - - // Always restore - props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], - - // Copy for children - props2 = [ "width", "height", "overflow" ], - cProps = [ "fontSize" ], - vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], - hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], - - // Set options - mode = $.effects.setMode( el, o.mode || "effect" ), - restore = o.restore || mode !== "effect", - scale = o.scale || "both", - origin = o.origin || [ "middle", "center" ], - position = el.css( "position" ), - props = restore ? props0 : props1, - zero = { - height: 0, - width: 0, - outerHeight: 0, - outerWidth: 0 - }; - - if ( mode === "show" ) { - el.show(); - } - original = { - height: el.height(), - width: el.width(), - outerHeight: el.outerHeight(), - outerWidth: el.outerWidth() - }; - - if ( o.mode === "toggle" && mode === "show" ) { - el.from = o.to || zero; - el.to = o.from || original; - } else { - el.from = o.from || ( mode === "show" ? zero : original ); - el.to = o.to || ( mode === "hide" ? zero : original ); - } - - // Set scaling factor - factor = { - from: { - y: el.from.height / original.height, - x: el.from.width / original.width - }, - to: { - y: el.to.height / original.height, - x: el.to.width / original.width - } - }; - - // Scale the css box - if ( scale === "box" || scale === "both" ) { - - // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { - props = props.concat( vProps ); - el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); - el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); - } - - // Horizontal props scaling - if ( factor.from.x !== factor.to.x ) { - props = props.concat( hProps ); - el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); - el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); - } - } - - // Scale the content - if ( scale === "content" || scale === "both" ) { - - // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { - props = props.concat( cProps ).concat( props2 ); - el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); - el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); - } - } - - $.effects.save( el, props ); - el.show(); - $.effects.createWrapper( el ); - el.css( "overflow", "hidden" ).css( el.from ); - - // Adjust - if (origin) { // Calculate baseline shifts - baseline = $.effects.getBaseline( origin, original ); - el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; - el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; - el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; - el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; - } - el.css( el.from ); // set top & left - - // Animate - if ( scale === "content" || scale === "both" ) { // Scale the children - - // Add margins/font-size - vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); - hProps = hProps.concat([ "marginLeft", "marginRight" ]); - props2 = props0.concat(vProps).concat(hProps); - - el.find( "*[width]" ).each( function(){ - var child = $( this ), - c_original = { - height: child.height(), - width: child.width(), - outerHeight: child.outerHeight(), - outerWidth: child.outerWidth() - }; - if (restore) { - $.effects.save(child, props2); - } - - child.from = { - height: c_original.height * factor.from.y, - width: c_original.width * factor.from.x, - outerHeight: c_original.outerHeight * factor.from.y, - outerWidth: c_original.outerWidth * factor.from.x - }; - child.to = { - height: c_original.height * factor.to.y, - width: c_original.width * factor.to.x, - outerHeight: c_original.height * factor.to.y, - outerWidth: c_original.width * factor.to.x - }; - - // Vertical props scaling - if ( factor.from.y !== factor.to.y ) { - child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); - child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); - } - - // Horizontal props scaling - if ( factor.from.x !== factor.to.x ) { - child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); - child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); - } - - // Animate children - child.css( child.from ); - child.animate( child.to, o.duration, o.easing, function() { - - // Restore children - if ( restore ) { - $.effects.restore( child, props2 ); - } - }); - }); - } - - // Animate - el.animate( el.to, { - queue: false, - duration: o.duration, - easing: o.easing, - complete: function() { - if ( el.to.opacity === 0 ) { - el.css( "opacity", el.from.opacity ); - } - if( mode === "hide" ) { - el.hide(); - } - $.effects.restore( el, props ); - if ( !restore ) { - - // we need to calculate our new positioning based on the scaling - if ( position === "static" ) { - el.css({ - position: "relative", - top: el.to.top, - left: el.to.left - }); - } else { - $.each([ "top", "left" ], function( idx, pos ) { - el.css( pos, function( _, str ) { - var val = parseInt( str, 10 ), - toRef = idx ? el.to.left : el.to.top; - - // if original was "auto", recalculate the new value from wrapper - if ( str === "auto" ) { - return toRef + "px"; - } - - return val + toRef + "px"; - }); - }); - } - } - - $.effects.removeWrapper( el ); - done(); - } - }); - -}; - })(jQuery); diff --git a/ui/jquery.ui.effect-size.js b/ui/jquery.ui.effect-size.js new file mode 100644 index 000000000..8643e5f0c --- /dev/null +++ b/ui/jquery.ui.effect-size.js @@ -0,0 +1,223 @@ +/*! + * jQuery UI Effects Size @VERSION + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/size-effect/ + * + * Depends: + * jquery.ui.effect.js + */ +(function( $, undefined ) { + +$.effects.effect.size = function( o, done ) { + + // Create element + var original, baseline, factor, + el = $( this ), + props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], + + // Always restore + props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], + + // Copy for children + props2 = [ "width", "height", "overflow" ], + cProps = [ "fontSize" ], + vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], + hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], + + // Set options + mode = $.effects.setMode( el, o.mode || "effect" ), + restore = o.restore || mode !== "effect", + scale = o.scale || "both", + origin = o.origin || [ "middle", "center" ], + position = el.css( "position" ), + props = restore ? props0 : props1, + zero = { + height: 0, + width: 0, + outerHeight: 0, + outerWidth: 0 + }; + + if ( mode === "show" ) { + el.show(); + } + original = { + height: el.height(), + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() + }; + + if ( o.mode === "toggle" && mode === "show" ) { + el.from = o.to || zero; + el.to = o.from || original; + } else { + el.from = o.from || ( mode === "show" ? zero : original ); + el.to = o.to || ( mode === "hide" ? zero : original ); + } + + // Set scaling factor + factor = { + from: { + y: el.from.height / original.height, + x: el.from.width / original.width + }, + to: { + y: el.to.height / original.height, + x: el.to.width / original.width + } + }; + + // Scale the css box + if ( scale === "box" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( vProps ); + el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + props = props.concat( hProps ); + el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); + el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); + } + } + + // Scale the content + if ( scale === "content" || scale === "both" ) { + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + props = props.concat( cProps ).concat( props2 ); + el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); + el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); + } + } + + $.effects.save( el, props ); + el.show(); + $.effects.createWrapper( el ); + el.css( "overflow", "hidden" ).css( el.from ); + + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + + // Animate + if ( scale === "content" || scale === "both" ) { // Scale the children + + // Add margins/font-size + vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); + hProps = hProps.concat([ "marginLeft", "marginRight" ]); + props2 = props0.concat(vProps).concat(hProps); + + el.find( "*[width]" ).each( function(){ + var child = $( this ), + c_original = { + height: child.height(), + width: child.width(), + outerHeight: child.outerHeight(), + outerWidth: child.outerWidth() + }; + if (restore) { + $.effects.save(child, props2); + } + + child.from = { + height: c_original.height * factor.from.y, + width: c_original.width * factor.from.x, + outerHeight: c_original.outerHeight * factor.from.y, + outerWidth: c_original.outerWidth * factor.from.x + }; + child.to = { + height: c_original.height * factor.to.y, + width: c_original.width * factor.to.x, + outerHeight: c_original.height * factor.to.y, + outerWidth: c_original.width * factor.to.x + }; + + // Vertical props scaling + if ( factor.from.y !== factor.to.y ) { + child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); + child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); + } + + // Horizontal props scaling + if ( factor.from.x !== factor.to.x ) { + child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); + child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); + } + + // Animate children + child.css( child.from ); + child.animate( child.to, o.duration, o.easing, function() { + + // Restore children + if ( restore ) { + $.effects.restore( child, props2 ); + } + }); + }); + } + + // Animate + el.animate( el.to, { + queue: false, + duration: o.duration, + easing: o.easing, + complete: function() { + if ( el.to.opacity === 0 ) { + el.css( "opacity", el.from.opacity ); + } + if( mode === "hide" ) { + el.hide(); + } + $.effects.restore( el, props ); + if ( !restore ) { + + // we need to calculate our new positioning based on the scaling + if ( position === "static" ) { + el.css({ + position: "relative", + top: el.to.top, + left: el.to.left + }); + } else { + $.each([ "top", "left" ], function( idx, pos ) { + el.css( pos, function( _, str ) { + var val = parseInt( str, 10 ), + toRef = idx ? el.to.left : el.to.top; + + // if original was "auto", recalculate the new value from wrapper + if ( str === "auto" ) { + return toRef + "px"; + } + + return val + toRef + "px"; + }); + }); + } + } + + $.effects.removeWrapper( el ); + done(); + } + }); + +}; + +})(jQuery); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 1c641ebb6..c0222629d 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -282,6 +282,8 @@ $.widget( "ui.menu", { icon = this.options.icons.submenu, submenus = this.element.find( this.options.menus ); + this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); + // Initialize nested menus submenus.filter( ":not(.ui-menu)" ) .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) @@ -387,7 +389,7 @@ $.widget( "ui.menu", { } nested = item.children( ".ui-menu" ); - if ( nested.length && ( /^mouse/.test( event.type ) ) ) { + if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { this._startOpening(nested); } this.activeMenu = item.parent(); |