diff options
author | Felix Nagel <info@felixnagel.com> | 2016-04-12 22:40:19 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2016-04-12 22:46:36 +0200 |
commit | b92f1b0f2f7e7918a30cf18b8b0490901eedc113 (patch) | |
tree | 10cb1f87e53677b7091d997de8f7b8d1d55c5aed | |
parent | 6baa74ba45a578ca403e3ebc5f61627105341c3b (diff) | |
parent | c19fc10e8493007af4617597f0afea5f24860955 (diff) | |
download | jquery-ui-b92f1b0f2f7e7918a30cf18b8b0490901eedc113.tar.gz jquery-ui-b92f1b0f2f7e7918a30cf18b8b0490901eedc113.zip |
Merge branch 'master' into datepicker
30 files changed, 327 insertions, 131 deletions
@@ -17,6 +17,7 @@ Christoph Rönsch <christoph.roensch@arcor.de> Corey Frang <gnarf37@gmail.com> <gnarf@gnarf.net> Courtland Allen <courtlandallen@gmail.com> Dan Streetman <ddstreet@ieee.org> +Dan Strohl <dstrohl@users.noreply.github.com> Danny Trunk <dtrunk90@gmail.com> <dtrunk90@googlemail.com> David De Sloovere <david.desloovere@outlook.com> <david.desloovere@hotmail.com> David Murdoch <david@davidmurdoch.com> <musicisair@yahoo.com> @@ -102,6 +103,7 @@ Sergey Kartashov <ebishkek@yandex.ru> Shahyar Ghobadpour <shahyar@gmail.com> Shane Whittet <whittet@gmail.com> Shannon Pekary <spekary@gmail.com> +Siebrand Mazeland <siebrand@kitano.nl> <s.mazeland@xs4all.nl> Simon Sattes <simon.sattes@gmail.com> Stojce Slavkovski <stojce@gmail.com> Tarafder Ashek-E-Elahi <mail.ashek@gmail.com> diff --git a/.travis.yml b/.travis.yml index 25350d712..fb3b75b1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ -sudo: false +sudo: required +dist: trusty language: node_js node_js: - "0.12" diff --git a/AUTHORS.txt b/AUTHORS.txt index 2e124d3d4..015200643 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -255,7 +255,7 @@ Gan Eng Chin <engchin.gan@gmail.com> Gabriel Schulhof <gabriel.schulhof@intel.com> Alexander Schmitz <arschmitz@gmail.com> Vilhjálmur Skúlason <vis@dmm.is> -Siebrand Mazeland <s.mazeland@xs4all.nl> +Siebrand Mazeland <siebrand@kitano.nl> Mohsen Ekhtiari <mohsenekhtiari@yahoo.com> Pere Orga <gotrunks@gmail.com> Jasper de Groot <mail@ugomobi.com> @@ -313,3 +313,12 @@ Hannah Methvin <hannahmethvin@gmail.com> Leonardo Balter <leonardo.balter@gmail.com> Benjamin Albert <benjamin_a5@yahoo.com> Michał Gołębiowski <m.goleb@gmail.com> +Alyosha Pushak <alyosha.pushak@gmail.com> +Fahad Ahmad <fahadahmad41@hotmail.com> +Matt Brundage <github@mattbrundage.com> +Francesc Baeta <francesc.baeta@gmail.com> +Piotr Baran <piotros@wp.pl> +Mukul Hase <mukulhase@gmail.com> +Konstantin Dinev <kdinev@mail.bw.edu> +Rand Scullard <rand@randscullard.com> +Dan Strohl diff --git a/Gruntfile.js b/Gruntfile.js index b7ace6cfd..fe5806bad 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -243,21 +243,6 @@ grunt.initConfig({ } }, - esformatter: { - options: { - preset: "jquery" - }, - ui: "ui/*.js", - tests: "tests/unit/**/*.js", - build: { - options: { - skipHashbang: true - }, - src: "build/**/*.js" - }, - grunt: "Gruntfile.js" - }, - bowercopy: { all: { options: { @@ -408,7 +393,7 @@ grunt.initConfig({ }); grunt.registerTask( "update-authors", function() { - var getAuthors = require( "grunt-git-authors" ), + var getAuthors = require( "grunt-git-authors" ).getAuthors, done = this.async(); getAuthors({ @@ -420,7 +405,9 @@ grunt.registerTask( "update-authors", function() { } authors = authors.map(function( author ) { - if ( author.match( /^Jacek Jędrzejewski </ ) ) { + if ( author.match( /^Dan Strohl </ ) ) { + return "Dan Strohl"; + } else if ( author.match( /^Jacek Jędrzejewski </ ) ) { return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)"; } else if ( author.match( /^Pawel Maruszczyk </ ) ) { return "Pawel Maruszczyk (http://hrabstwo.net)"; diff --git a/demos/controlgroup/toolbar.html b/demos/controlgroup/toolbar.html index 14f9842c8..81f5ffb6d 100644 --- a/demos/controlgroup/toolbar.html +++ b/demos/controlgroup/toolbar.html @@ -154,7 +154,7 @@ <button id="underline">U</button> </div> - <pre id="page" contenteditable='true'> + <pre id="page" contenteditable="true"> The Rime of the Ancient Mariner (text of 1834) BY SAMUEL TAYLOR COLERIDGE Argument diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html index b77aaf663..6ca68cac8 100644 --- a/demos/selectmenu/custom_render.html +++ b/demos/selectmenu/custom_render.html @@ -44,7 +44,7 @@ </script> <style> h2 { - margin: 30px 0 0 0 + margin: 30px 0 0 0; } fieldset { border: 0; diff --git a/package.json b/package.json index 7bd301b61..6d6437baa 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "type": "git", "url": "git://github.com/jquery/jquery-ui.git" }, - "bugs": "http://bugs.jqueryui.com/", + "bugs": "https://bugs.jqueryui.com/", "license": "MIT", "scripts": { "test": "grunt" @@ -53,23 +53,22 @@ "dependencies": {}, "devDependencies": { "cldr-data": ">=26", - "commitplease": "2.0.0", - "globalize-compiler": "0.1.1", - "grunt": "0.4.2", - "grunt-bowercopy": "1.1.0", + "commitplease": "2.3.0", + "globalize-compiler": "0.1.1", + "grunt": "0.4.5", + "grunt-bowercopy": "1.2.4", "grunt-compare-size": "0.4.0", "grunt-contrib-concat": "0.5.1", - "grunt-contrib-csslint": "0.2.0", - "grunt-contrib-jshint": "0.7.1", - "grunt-contrib-qunit": "0.6.0", + "grunt-contrib-csslint": "0.5.0", + "grunt-contrib-jshint": "0.12.0", + "grunt-contrib-qunit": "1.0.1", "grunt-contrib-requirejs": "0.4.4", - "grunt-contrib-uglify": "0.1.1", - "grunt-esformatter": "0.2.0", - "grunt-git-authors": "2.0.0", - "grunt-html": "4.0.1", + "grunt-contrib-uglify": "0.11.1", + "grunt-git-authors": "3.1.0", + "grunt-html": "6.0.0", "grunt-jscs": "2.1.0", - "load-grunt-tasks": "0.3.0", - "rimraf": "2.1.4", + "load-grunt-tasks": "3.4.0", + "rimraf": "2.5.1", "testswarm": "1.1.0" }, "keywords": [] diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 683b87456..ce5856755 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -8,12 +8,16 @@ <script src="../../lib/css.js" data-modules="core accordion"></script> <script src="../../lib/bootstrap.js" data-widget="accordion"></script> <style> - #list, #list1 *, #navigation, #navigation * { + #list, #list1 *, #navigation, #navigation *, #collapsible, #collapsible * { margin: 0; padding: 0; font-size: 12px; line-height: 15px; } + #collapsibleWrapper { + width: 300px; + float: left; + } </style> </head> <body> @@ -109,6 +113,19 @@ </dd> </dl> +<div id="collapsibleWrapper"> + <div id="collapsible"> + <h3>Header</h3> + <div> + <p> + The calculated height of this accordion should be the same + regardless of whether the accordion was collapsed or not + when the height was calculated. + </p> + </div> + </div> +</div> + </div> </body> </html> diff --git a/tests/unit/accordion/options.js b/tests/unit/accordion/options.js index c9b2e3aaf..228a8be40 100644 --- a/tests/unit/accordion/options.js +++ b/tests/unit/accordion/options.js @@ -48,6 +48,22 @@ test( "{ active: false }", function() { strictEqual( element.accordion( "option", "active" ), 0 ); } ); +// http://bugs.jqueryui.com/ticket/11938 +test( "{ active: false, collapsible: true }", function() { + expect( 1 ); + var element = $( "#collapsible" ).accordion(), + height = element.outerHeight(); + + element + .accordion( "destroy" ) + .accordion( { + active: false, + collapsible: true + } ) + .accordion( "option", "active", 0 ); + equal( element.outerHeight(), height ); +} ); + test( "{ active: Number }", function() { expect( 8 ); var element = $( "#list1" ).accordion( { diff --git a/tests/unit/draggable/core.js b/tests/unit/draggable/core.js index 61d8503ea..a36852ebb 100644 --- a/tests/unit/draggable/core.js +++ b/tests/unit/draggable/core.js @@ -291,7 +291,7 @@ test( "#8399: A draggable should become the active element after you are finishe strictEqual( document.activeElement, element.get( 0 ), "finishing moving a draggable anchor made it the active element" ); } ); -asyncTest( "blur behavior", function() { +asyncTest( "blur behavior - handle is main element", function() { expect( 3 ); var element = $( "#draggable1" ).draggable(), @@ -315,6 +315,26 @@ asyncTest( "blur behavior", function() { } ); } ); +asyncTest( "blur behavior - descendant of handle", function() { + expect( 2 ); + + var element = $( "#draggable2" ).draggable( { handle: "span" } ), + + // The handle is a descendant, but we also want to grab a descendant of the handle + handle = element.find( "span em" ), + focusElement = $( "<div tabindex='1'></div>" ).appendTo( element ); + + testHelper.onFocus( focusElement, function() { + strictEqual( document.activeElement, focusElement.get( 0 ), "test element is focused before mousing down on a draggable" ); + + testHelper.move( handle, 50, 50 ); + + // Elements outside of the handle should blur (#12472, #14905) + notStrictEqual( document.activeElement, focusElement.get( 0 ), "test element is no longer focused after mousing down on a draggable" ); + start(); + } ); +} ); + test( "ui-draggable-handle assigned to appropriate element", function( assert ) { expect( 5 ); diff --git a/tests/unit/menu/core.js b/tests/unit/menu/core.js index a8e0ece00..200812f4e 100644 --- a/tests/unit/menu/core.js +++ b/tests/unit/menu/core.js @@ -73,4 +73,34 @@ asyncTest( "#9532: Need a way in Menu to keep ui-state-active class on selected } ); } ); +asyncTest( "active menu item styling", function( assert ) { + expect( 5 ); + function isActive( item ) { + assert.hasClasses( item.children( ".ui-menu-item-wrapper" ), "ui-state-active" ); + } + function isInactive( item ) { + assert.lacksClasses( item.children( ".ui-menu-item-wrapper" ), "ui-state-active" ); + } + $.ui.menu.prototype.delay = 0; + var element = $( "#menu4" ).menu(); + var parentItem = element.children( "li:eq(1)" ); + var childItem = parentItem.find( "li:eq(0)" ); + element.menu( "focus", null, parentItem ); + setTimeout( function() { + isActive( parentItem ); + element.menu( "focus", null, childItem ); + setTimeout( function() { + isActive( parentItem ); + isActive( childItem ); + element.blur(); + setTimeout( function() { + isInactive( parentItem ); + isInactive( childItem ); + $.ui.menu.prototype.delay = 300; + start(); + }, 50 ); + } ); + } ); +} ); + } ); diff --git a/tests/unit/resizable/options.js b/tests/unit/resizable/options.js index 2d44eb8ee..ae390ad93 100644 --- a/tests/unit/resizable/options.js +++ b/tests/unit/resizable/options.js @@ -410,6 +410,33 @@ test( "zIndex, applied to all handles", function() { } ); } ); +test( "setOption handles", function() { + expect( 11 ); + + var target = $( "<div></div>" ).resizable(); + + function checkHandles( expectedHandles ) { + expectedHandles = expectedHandles.map( function( value ) { + return ".ui-resizable-" + value; + } ); + + var handles = target.find( ".ui-resizable-handle" ); + + equal( handles.length, expectedHandles.length, "Correct number of handles found" ); + $.each( expectedHandles, function( index, handleClass ) { + equal( handles.filter( handleClass ).length, 1, "Found " + handleClass ); + } ); + } + + checkHandles( [ "e", "s", "se" ] ); + + target.resizable( "option", "handles", "n, w, nw" ); + checkHandles( [ "n", "w", "nw" ] ); + + target.resizable( "option", "handles", "s, w" ); + checkHandles( [ "s", "w" ] ); +} ); + test( "alsoResize + containment", function() { expect( 4 ); var other = $( "<div>" ) diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js index 1c1a6b622..5fd47d7f1 100644 --- a/tests/unit/selectmenu/core.js +++ b/tests/unit/selectmenu/core.js @@ -6,18 +6,22 @@ define( [ module( "selectmenu: core" ); test( "markup structure", function( assert ) { - expect( 4 ); + expect( 7 ); var element = $( "#files" ).selectmenu(), button = element.selectmenu( "widget" ), + icon = button.find( ".ui-icon" ), menu = element.selectmenu( "menuWidget" ), menuWrap = menu.parent(); + assert.strictEqual( icon.length, 1, "Exactly one icon exists" ); + assert.hasClasses( icon, "ui-selectmenu-icon" ); assert.hasClasses( button, "ui-selectmenu-button ui-selectmenu-button-closed ui-widget" ); assert.lacksClasses( button, "ui-selectmenu-button-open ui-selectmenu-open" ); assert.hasClasses( menuWrap, "ui-selectmenu-menu" ); assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" ); + assert.strictEqual( icon[ 0 ], button.children()[ 0 ], "Icon is first child of button" ); } ); asyncTest( "accessibility", function() { diff --git a/tests/unit/slider/options.js b/tests/unit/slider/options.js index 031031cdc..5f3ea1111 100644 --- a/tests/unit/slider/options.js +++ b/tests/unit/slider/options.js @@ -43,7 +43,7 @@ test( "disabled", function( assert ) { } ); test( "max", function() { - expect( 5 ); + expect( 7 ); element = $( "<div></div>" ); options = { @@ -87,6 +87,23 @@ test( "max", function() { ok( element.slider( "value" ) === options.max, "value method will max, step is changed and step is float" ); element.slider( "destroy" ); + options = { + max: 10.75, + min: 1.22, + orientation: "horizontal", + step: 0.01, + value: 10.75 + }; + + element.slider( options ); + ok( element.slider( "value" ) === options.max, "value method will max, step is changed, step is float and max is float" ); + element.slider( "destroy" ); + + options.max = 10.749999999; + + element.slider( options ); + ok( element.slider( "value" ) === 10.74, "value method will max, step is changed, step is float, max is float and not divisible" ); + element.slider( "destroy" ); } ); test( "min", function() { diff --git a/tests/visual/dialog/performance.html b/tests/visual/dialog/performance.html index 20adbfa6b..45ef90941 100644 --- a/tests/visual/dialog/performance.html +++ b/tests/visual/dialog/performance.html @@ -10,17 +10,17 @@ html = new Array( 500 ).join( $.trim( $( "#template" ).html() ) ); $( html ).appendTo( "body" ); - start = $.now(); + start = new Date(); $( "#dialog" ).dialog({ modal: true, autoOpen: false }); - $( "<li>Create: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" ); + $( "<li>Create: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" ); $( "#opener" ).on( "click", function() { - start = $.now(); + start = new Date(); $( "#dialog" ).dialog( "open" ); - $( "<li>Open: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" ); + $( "<li>Open: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" ); }); </script> </head> diff --git a/tests/visual/tooltip/animations.html b/tests/visual/tooltip/animations.html index 7427d7ebd..2feabeab1 100644 --- a/tests/visual/tooltip/animations.html +++ b/tests/visual/tooltip/animations.html @@ -12,11 +12,12 @@ } </style> <script src="../../../external/requirejs/require.js"></script> - <script src="../../../demos/bootstrap.js"> + <script src="../../../demos/bootstrap.js" + data-modules="effect effect-explode effect-bounce effect-blind effect-drop"> $( "pre" ).each(function( index, elem ) { $( elem ) .attr( "title", "animated tooltips" ) - .tooltip( $.parseJSON( $( elem ).text() ) ); + .tooltip( JSON.parse( $( elem ).text() ) ); }); </script> </head> diff --git a/themes/base/menu.css b/themes/base/menu.css index afd933586..0f01a0cae 100644 --- a/themes/base/menu.css +++ b/themes/base/menu.css @@ -13,7 +13,7 @@ padding: 0; margin: 0; display: block; - outline: none; + outline: 0; } .ui-menu .ui-menu { position: absolute; diff --git a/themes/base/selectmenu.css b/themes/base/selectmenu.css index 3449c19b5..3299f9e4d 100644 --- a/themes/base/selectmenu.css +++ b/themes/base/selectmenu.css @@ -33,10 +33,18 @@ .ui-selectmenu-open { display: block; } -.ui-selectmenu-button.ui-button { - text-align: left; +.ui-selectmenu-text { + display: block; + margin-right: 20px; overflow: hidden; text-overflow: ellipsis; +} +.ui-selectmenu-button.ui-button { + text-align: left; white-space: nowrap; width: 14em; } +.ui-selectmenu-icon.ui-icon { + float: right; + margin-top: 0; +} diff --git a/ui/data.js b/ui/data.js index f76098d8c..d0417b8f9 100644 --- a/ui/data.js +++ b/ui/data.js @@ -7,7 +7,7 @@ * http://jquery.org/license */ -//>>label: :data +//>>label: :data Selector //>>group: Core //>>description: Selects elements which have data stored under the specified key. //>>docs: http://api.jqueryui.com/data-selector/ diff --git a/ui/focusable.js b/ui/focusable.js index 6b7a0b1f1..b8355b96c 100644 --- a/ui/focusable.js +++ b/ui/focusable.js @@ -7,7 +7,7 @@ * http://jquery.org/license */ -//>>label: focusable +//>>label: :focusable Selector //>>group: Core //>>description: Selects elements which can be focused. //>>docs: http://api.jqueryui.com/focusable-selector/ diff --git a/ui/tabbable.js b/ui/tabbable.js index 86bebb77b..3baa641ce 100644 --- a/ui/tabbable.js +++ b/ui/tabbable.js @@ -7,7 +7,7 @@ * http://jquery.org/license */ -//>>label: focusable +//>>label: :tabbable Selector //>>group: Core //>>description: Selects elements which can be tabbed to. //>>docs: http://api.jqueryui.com/tabbable-selector/ diff --git a/ui/widgets/accordion.js b/ui/widgets/accordion.js index 14b3f7303..359b4c46f 100644 --- a/ui/widgets/accordion.js +++ b/ui/widgets/accordion.js @@ -373,7 +373,14 @@ return $.widget( "ui.accordion", { maxHeight = 0; this.headers.next() .each( function() { + var isVisible = $( this ).is( ":visible" ); + if ( !isVisible ) { + $( this ).show(); + } maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); + if ( !isVisible ) { + $( this ).hide(); + } } ) .height( maxHeight ); } diff --git a/ui/widgets/autocomplete.js b/ui/widgets/autocomplete.js index 060d8e94f..079b0dab0 100644 --- a/ui/widgets/autocomplete.js +++ b/ui/widgets/autocomplete.js @@ -82,7 +82,7 @@ $.widget( "ui.autocomplete", { // Inputs are always single-line, even if inside a contentEditable element // IE also treats inputs as contentEditable // All other element types are determined by whether or not they're contentEditable - this.isMultiLine = isTextarea || !isInput && this.element.prop( "isContentEditable" ); + this.isMultiLine = isTextarea || !isInput && this._isContentEditable( this.element ); this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; this.isNewMenu = true; @@ -614,6 +614,24 @@ $.widget( "ui.autocomplete", { // Prevents moving cursor to beginning/end of the text field in some browsers event.preventDefault(); } + }, + + // Support: Chrome <=50 + // We should be able to just use this.element.prop( "isContentEditable" ) + // but hidden elements always report false in Chrome. + // https://code.google.com/p/chromium/issues/detail?id=313082 + _isContentEditable: function( element ) { + if ( !element.length ) { + return false; + } + + var editable = element.prop( "contentEditable" ); + + if ( editable === "inherit" ) { + return this._isContentEditable( element.parent() ); + } + + return editable === "true"; } } ); diff --git a/ui/widgets/checkboxradio.js b/ui/widgets/checkboxradio.js index 107749201..300cae8ce 100644 --- a/ui/widgets/checkboxradio.js +++ b/ui/widgets/checkboxradio.js @@ -115,7 +115,9 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { if ( checked ) { this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); - this._addClass( this.icon, null, "ui-state-hover" ); + if ( this.icon ) { + this._addClass( this.icon, null, "ui-state-hover" ); + } } this._on( { diff --git a/ui/widgets/draggable.js b/ui/widgets/draggable.js index 7da09b7ec..32bf861ed 100644 --- a/ui/widgets/draggable.js +++ b/ui/widgets/draggable.js @@ -143,14 +143,19 @@ $.widget( "ui.draggable", $.ui.mouse, { }, _blurActiveElement: function( event ) { - - // Only need to blur if the event occurred on the draggable itself, see #10527 - if ( !this.handleElement.is( event.target ) ) { + var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ), + target = $( event.target ); + + // Only blur if the event occurred on an element that is: + // 1) within the draggable handle + // 2) but not within the currently focused element + // See #10527, #12472 + if ( this._getHandle( event ) && target.closest( activeElement ).length ) { return; } // Blur any element that currently has focus, see #4261 - $.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); + $.ui.safeBlur( activeElement ); }, _mouseStart: function( event ) { diff --git a/ui/widgets/menu.js b/ui/widgets/menu.js index e7b13e7c9..f63105fa7 100644 --- a/ui/widgets/menu.js +++ b/ui/widgets/menu.js @@ -270,7 +270,7 @@ return $.widget( "ui.menu", { }, _activate: function( event ) { - if ( !this.active.is( ".ui-state-disabled" ) ) { + if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { if ( this.active.children( "[aria-haspopup='true']" ).length ) { this.expand( event ); } else { @@ -487,6 +487,10 @@ return $.widget( "ui.menu", { this._close( currentMenu ); this.blur( event ); + + // Work around active item staying active after menu is blurred + this._removeClass( currentMenu.find( ".ui-state-active" ), null, "ui-state-active" ); + this.activeMenu = currentMenu; }, this.delay ); }, @@ -498,14 +502,10 @@ return $.widget( "ui.menu", { startMenu = this.active ? this.active.parent() : this.element; } - var active = startMenu - .find( ".ui-menu" ) - .hide() - .attr( "aria-hidden", "true" ) - .attr( "aria-expanded", "false" ) - .end() - .find( ".ui-state-active" ).not( ".ui-menu-item-wrapper" ); - this._removeClass( active, null, "ui-state-active" ); + startMenu.find( ".ui-menu" ) + .hide() + .attr( "aria-hidden", "true" ) + .attr( "aria-expanded", "false" ); }, _closeOnDocumentClick: function( event ) { diff --git a/ui/widgets/resizable.js b/ui/widgets/resizable.js index 88ad41180..a811c6334 100644 --- a/ui/widgets/resizable.js +++ b/ui/widgets/resizable.js @@ -99,9 +99,9 @@ $.widget( "ui.resizable", $.ui.mouse, { _create: function() { - var n, i, handle, axis, hname, margins, - that = this, - o = this.options; + var margins, + o = this.options, + that = this; this._addClass( "ui-resizable" ); $.extend( this, { @@ -159,6 +159,80 @@ $.widget( "ui.resizable", $.ui.mouse, { this._proportionallyResize(); } + this._setupHandles(); + + if ( o.autoHide ) { + $( this.element ) + .on( "mouseenter", function() { + if ( o.disabled ) { + return; + } + that._removeClass( "ui-resizable-autohide" ); + that._handles.show(); + } ) + .on( "mouseleave", function() { + if ( o.disabled ) { + return; + } + if ( !that.resizing ) { + that._addClass( "ui-resizable-autohide" ); + that._handles.hide(); + } + } ); + } + + this._mouseInit(); + }, + + _destroy: function() { + + this._mouseDestroy(); + + var wrapper, + _destroy = function( exp ) { + $( exp ) + .removeData( "resizable" ) + .removeData( "ui-resizable" ) + .off( ".resizable" ) + .find( ".ui-resizable-handle" ) + .remove(); + }; + + // TODO: Unwrap at same DOM position + if ( this.elementIsWrapper ) { + _destroy( this.element ); + wrapper = this.element; + this.originalElement.css( { + position: wrapper.css( "position" ), + width: wrapper.outerWidth(), + height: wrapper.outerHeight(), + top: wrapper.css( "top" ), + left: wrapper.css( "left" ) + } ).insertAfter( wrapper ); + wrapper.remove(); + } + + this.originalElement.css( "resize", this.originalResizeStyle ); + _destroy( this.originalElement ); + + return this; + }, + + _setOption: function( key, value ) { + this._super( key, value ); + + switch ( key ) { + case "handles": + this._removeHandles(); + this._setupHandles(); + break; + default: + break; + } + }, + + _setupHandles: function() { + var o = this.options, handle, i, n, hname, axis, that = this; this.handles = o.handles || ( !$( ".ui-resizable-handle", this.element ).length ? "e,s,se" : { @@ -250,60 +324,11 @@ $.widget( "ui.resizable", $.ui.mouse, { if ( o.autoHide ) { this._handles.hide(); this._addClass( "ui-resizable-autohide" ); - $( this.element ) - .on( "mouseenter", function() { - if ( o.disabled ) { - return; - } - that._removeClass( "ui-resizable-autohide" ); - that._handles.show(); - } ) - .on( "mouseleave", function() { - if ( o.disabled ) { - return; - } - if ( !that.resizing ) { - that._addClass( "ui-resizable-autohide" ); - that._handles.hide(); - } - } ); } - - this._mouseInit(); }, - _destroy: function() { - - this._mouseDestroy(); - - var wrapper, - _destroy = function( exp ) { - $( exp ) - .removeData( "resizable" ) - .removeData( "ui-resizable" ) - .off( ".resizable" ) - .find( ".ui-resizable-handle" ) - .remove(); - }; - - // TODO: Unwrap at same DOM position - if ( this.elementIsWrapper ) { - _destroy( this.element ); - wrapper = this.element; - this.originalElement.css( { - position: wrapper.css( "position" ), - width: wrapper.outerWidth(), - height: wrapper.outerHeight(), - top: wrapper.css( "top" ), - left: wrapper.css( "left" ) - } ).insertAfter( wrapper ); - wrapper.remove(); - } - - this.originalElement.css( "resize", this.originalResizeStyle ); - _destroy( this.originalElement ); - - return this; + _removeHandles: function() { + this._handles.remove(); }, _mouseCapture: function( event ) { @@ -582,7 +607,7 @@ $.widget( "ui.resizable", $.ui.mouse, { isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), dw = this.originalPosition.left + this.originalSize.width, - dh = this.position.top + this.size.height, + dh = this.originalPosition.top + this.originalSize.height, cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); if ( isminw ) { data.width = o.minWidth; diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js index b251f04f1..87f88623f 100644 --- a/ui/widgets/selectmenu.js +++ b/ui/widgets/selectmenu.js @@ -84,7 +84,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { }, _drawButton: function() { - var icon, space, + var icon, that = this, item = this._parseOption( this.element.find( "option:selected" ), @@ -119,12 +119,8 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, { this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed", "ui-button ui-widget" ); - icon = $( "<span>" ).prependTo( this.button ); - space = $( "<span> </span>" ); - this._addClass( space, "ui-selectmenu-icon-space" ); - this._addClass( icon, null, "ui-icon " + this.options.icons.button ); - icon.after( space ); - + icon = $( "<span>" ).appendTo( this.button ); + this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button ); this.buttonItem = this._renderButtonItem( item ) .appendTo( this.button ); diff --git a/ui/widgets/slider.js b/ui/widgets/slider.js index a2da892c4..8af032dcf 100644 --- a/ui/widgets/slider.js +++ b/ui/widgets/slider.js @@ -544,8 +544,13 @@ return $.widget( "ui.slider", $.ui.mouse, { var max = this.options.max, min = this._valueMin(), step = this.options.step, - aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step; + aboveMin = Math.round( ( max - min ) / step ) * step; max = aboveMin + min; + if ( max > this.options.max ) { + + //If max is not divisible by step, rounding off may increase its value + max -= step; + } this.max = parseFloat( max.toFixed( this._precision() ) ); }, diff --git a/ui/widgets/sortable.js b/ui/widgets/sortable.js index 8920ed967..ec26250b5 100644 --- a/ui/widgets/sortable.js +++ b/ui/widgets/sortable.js @@ -908,7 +908,7 @@ return $.widget( "ui.sortable", $.ui.mouse, { floating = innermostContainer.floating || this._isFloating( this.currentItem ); posProperty = floating ? "left" : "top"; sizeProperty = floating ? "width" : "height"; - axis = floating ? "clientX" : "clientY"; + axis = floating ? "pageX" : "pageY"; for ( j = this.items.length - 1; j >= 0; j-- ) { if ( !$.contains( this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) ) { @@ -1072,7 +1072,7 @@ return $.widget( "ui.sortable", $.ui.mouse, { 0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, o.containment === "document" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, - ( o.containment === "document" ? this.document.width() : this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top + ( o.containment === "document" ? ( this.document.height() || document.body.parentNode.scrollHeight ) : this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top ]; } |