Merge branch 'master' into datepicker

This commit is contained in:
Felix Nagel 2016-04-12 22:40:19 +02:00
commit b92f1b0f2f
30 changed files with 326 additions and 130 deletions

View File

@ -17,6 +17,7 @@ Christoph Rönsch <christoph.roensch@arcor.de>
Corey Frang <gnarf37@gmail.com> <gnarf@gnarf.net> Corey Frang <gnarf37@gmail.com> <gnarf@gnarf.net>
Courtland Allen <courtlandallen@gmail.com> Courtland Allen <courtlandallen@gmail.com>
Dan Streetman <ddstreet@ieee.org> Dan Streetman <ddstreet@ieee.org>
Dan Strohl <dstrohl@users.noreply.github.com>
Danny Trunk <dtrunk90@gmail.com> <dtrunk90@googlemail.com> Danny Trunk <dtrunk90@gmail.com> <dtrunk90@googlemail.com>
David De Sloovere <david.desloovere@outlook.com> <david.desloovere@hotmail.com> David De Sloovere <david.desloovere@outlook.com> <david.desloovere@hotmail.com>
David Murdoch <david@davidmurdoch.com> <musicisair@yahoo.com> David Murdoch <david@davidmurdoch.com> <musicisair@yahoo.com>
@ -102,6 +103,7 @@ Sergey Kartashov <ebishkek@yandex.ru>
Shahyar Ghobadpour <shahyar@gmail.com> Shahyar Ghobadpour <shahyar@gmail.com>
Shane Whittet <whittet@gmail.com> Shane Whittet <whittet@gmail.com>
Shannon Pekary <spekary@gmail.com> Shannon Pekary <spekary@gmail.com>
Siebrand Mazeland <siebrand@kitano.nl> <s.mazeland@xs4all.nl>
Simon Sattes <simon.sattes@gmail.com> Simon Sattes <simon.sattes@gmail.com>
Stojce Slavkovski <stojce@gmail.com> Stojce Slavkovski <stojce@gmail.com>
Tarafder Ashek-E-Elahi <mail.ashek@gmail.com> Tarafder Ashek-E-Elahi <mail.ashek@gmail.com>

View File

@ -1,4 +1,5 @@
sudo: false sudo: required
dist: trusty
language: node_js language: node_js
node_js: node_js:
- "0.12" - "0.12"

View File

@ -255,7 +255,7 @@ Gan Eng Chin <engchin.gan@gmail.com>
Gabriel Schulhof <gabriel.schulhof@intel.com> Gabriel Schulhof <gabriel.schulhof@intel.com>
Alexander Schmitz <arschmitz@gmail.com> Alexander Schmitz <arschmitz@gmail.com>
Vilhjálmur Skúlason <vis@dmm.is> Vilhjálmur Skúlason <vis@dmm.is>
Siebrand Mazeland <s.mazeland@xs4all.nl> Siebrand Mazeland <siebrand@kitano.nl>
Mohsen Ekhtiari <mohsenekhtiari@yahoo.com> Mohsen Ekhtiari <mohsenekhtiari@yahoo.com>
Pere Orga <gotrunks@gmail.com> Pere Orga <gotrunks@gmail.com>
Jasper de Groot <mail@ugomobi.com> Jasper de Groot <mail@ugomobi.com>
@ -313,3 +313,12 @@ Hannah Methvin <hannahmethvin@gmail.com>
Leonardo Balter <leonardo.balter@gmail.com> Leonardo Balter <leonardo.balter@gmail.com>
Benjamin Albert <benjamin_a5@yahoo.com> Benjamin Albert <benjamin_a5@yahoo.com>
Michał Gołębiowski <m.goleb@gmail.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

View File

@ -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: { bowercopy: {
all: { all: {
options: { options: {
@ -408,7 +393,7 @@ grunt.initConfig({
}); });
grunt.registerTask( "update-authors", function() { grunt.registerTask( "update-authors", function() {
var getAuthors = require( "grunt-git-authors" ), var getAuthors = require( "grunt-git-authors" ).getAuthors,
done = this.async(); done = this.async();
getAuthors({ getAuthors({
@ -420,7 +405,9 @@ grunt.registerTask( "update-authors", function() {
} }
authors = authors.map(function( author ) { 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)"; return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)";
} else if ( author.match( /^Pawel Maruszczyk </ ) ) { } else if ( author.match( /^Pawel Maruszczyk </ ) ) {
return "Pawel Maruszczyk (http://hrabstwo.net)"; return "Pawel Maruszczyk (http://hrabstwo.net)";

View File

@ -154,7 +154,7 @@
<button id="underline">U</button> <button id="underline">U</button>
</div> </div>
<pre id="page" contenteditable='true'> <pre id="page" contenteditable="true">
The Rime of the Ancient Mariner (text of 1834) The Rime of the Ancient Mariner (text of 1834)
BY SAMUEL TAYLOR COLERIDGE BY SAMUEL TAYLOR COLERIDGE
Argument Argument

View File

@ -44,7 +44,7 @@
</script> </script>
<style> <style>
h2 { h2 {
margin: 30px 0 0 0 margin: 30px 0 0 0;
} }
fieldset { fieldset {
border: 0; border: 0;

View File

@ -45,7 +45,7 @@
"type": "git", "type": "git",
"url": "git://github.com/jquery/jquery-ui.git" "url": "git://github.com/jquery/jquery-ui.git"
}, },
"bugs": "http://bugs.jqueryui.com/", "bugs": "https://bugs.jqueryui.com/",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "grunt" "test": "grunt"
@ -53,23 +53,22 @@
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"cldr-data": ">=26", "cldr-data": ">=26",
"commitplease": "2.0.0", "commitplease": "2.3.0",
"globalize-compiler": "0.1.1", "globalize-compiler": "0.1.1",
"grunt": "0.4.2", "grunt": "0.4.5",
"grunt-bowercopy": "1.1.0", "grunt-bowercopy": "1.2.4",
"grunt-compare-size": "0.4.0", "grunt-compare-size": "0.4.0",
"grunt-contrib-concat": "0.5.1", "grunt-contrib-concat": "0.5.1",
"grunt-contrib-csslint": "0.2.0", "grunt-contrib-csslint": "0.5.0",
"grunt-contrib-jshint": "0.7.1", "grunt-contrib-jshint": "0.12.0",
"grunt-contrib-qunit": "0.6.0", "grunt-contrib-qunit": "1.0.1",
"grunt-contrib-requirejs": "0.4.4", "grunt-contrib-requirejs": "0.4.4",
"grunt-contrib-uglify": "0.1.1", "grunt-contrib-uglify": "0.11.1",
"grunt-esformatter": "0.2.0", "grunt-git-authors": "3.1.0",
"grunt-git-authors": "2.0.0", "grunt-html": "6.0.0",
"grunt-html": "4.0.1",
"grunt-jscs": "2.1.0", "grunt-jscs": "2.1.0",
"load-grunt-tasks": "0.3.0", "load-grunt-tasks": "3.4.0",
"rimraf": "2.1.4", "rimraf": "2.5.1",
"testswarm": "1.1.0" "testswarm": "1.1.0"
}, },
"keywords": [] "keywords": []

View File

@ -8,12 +8,16 @@
<script src="../../lib/css.js" data-modules="core accordion"></script> <script src="../../lib/css.js" data-modules="core accordion"></script>
<script src="../../lib/bootstrap.js" data-widget="accordion"></script> <script src="../../lib/bootstrap.js" data-widget="accordion"></script>
<style> <style>
#list, #list1 *, #navigation, #navigation * { #list, #list1 *, #navigation, #navigation *, #collapsible, #collapsible * {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 12px; font-size: 12px;
line-height: 15px; line-height: 15px;
} }
#collapsibleWrapper {
width: 300px;
float: left;
}
</style> </style>
</head> </head>
<body> <body>
@ -109,6 +113,19 @@
</dd> </dd>
</dl> </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> </div>
</body> </body>
</html> </html>

View File

@ -48,6 +48,22 @@ test( "{ active: false }", function() {
strictEqual( element.accordion( "option", "active" ), 0 ); 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() { test( "{ active: Number }", function() {
expect( 8 ); expect( 8 );
var element = $( "#list1" ).accordion( { var element = $( "#list1" ).accordion( {

View File

@ -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" ); 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 ); expect( 3 );
var element = $( "#draggable1" ).draggable(), 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 ) { test( "ui-draggable-handle assigned to appropriate element", function( assert ) {
expect( 5 ); expect( 5 );

View File

@ -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 );
} );
} );
} );
} ); } );

View File

@ -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() { test( "alsoResize + containment", function() {
expect( 4 ); expect( 4 );
var other = $( "<div>" ) var other = $( "<div>" )

View File

@ -6,18 +6,22 @@ define( [
module( "selectmenu: core" ); module( "selectmenu: core" );
test( "markup structure", function( assert ) { test( "markup structure", function( assert ) {
expect( 4 ); expect( 7 );
var element = $( "#files" ).selectmenu(), var element = $( "#files" ).selectmenu(),
button = element.selectmenu( "widget" ), button = element.selectmenu( "widget" ),
icon = button.find( ".ui-icon" ),
menu = element.selectmenu( "menuWidget" ), menu = element.selectmenu( "menuWidget" ),
menuWrap = menu.parent(); menuWrap = menu.parent();
assert.strictEqual( icon.length, 1, "Exactly one icon exists" );
assert.hasClasses( icon, "ui-selectmenu-icon" );
assert.hasClasses( button, assert.hasClasses( button,
"ui-selectmenu-button ui-selectmenu-button-closed ui-widget" ); "ui-selectmenu-button ui-selectmenu-button-closed ui-widget" );
assert.lacksClasses( button, "ui-selectmenu-button-open ui-selectmenu-open" ); assert.lacksClasses( button, "ui-selectmenu-button-open ui-selectmenu-open" );
assert.hasClasses( menuWrap, "ui-selectmenu-menu" ); assert.hasClasses( menuWrap, "ui-selectmenu-menu" );
assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" ); assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" );
assert.strictEqual( icon[ 0 ], button.children()[ 0 ], "Icon is first child of button" );
} ); } );
asyncTest( "accessibility", function() { asyncTest( "accessibility", function() {

View File

@ -43,7 +43,7 @@ test( "disabled", function( assert ) {
} ); } );
test( "max", function() { test( "max", function() {
expect( 5 ); expect( 7 );
element = $( "<div></div>" ); element = $( "<div></div>" );
options = { 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" ); ok( element.slider( "value" ) === options.max, "value method will max, step is changed and step is float" );
element.slider( "destroy" ); 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() { test( "min", function() {

View File

@ -10,17 +10,17 @@
html = new Array( 500 ).join( $.trim( $( "#template" ).html() ) ); html = new Array( 500 ).join( $.trim( $( "#template" ).html() ) );
$( html ).appendTo( "body" ); $( html ).appendTo( "body" );
start = $.now(); start = new Date();
$( "#dialog" ).dialog({ $( "#dialog" ).dialog({
modal: true, modal: true,
autoOpen: false autoOpen: false
}); });
$( "<li>Create: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" ); $( "<li>Create: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" );
$( "#opener" ).on( "click", function() { $( "#opener" ).on( "click", function() {
start = $.now(); start = new Date();
$( "#dialog" ).dialog( "open" ); $( "#dialog" ).dialog( "open" );
$( "<li>Open: " + ($.now() - start) + "ms</li>" ).appendTo( "#log" ); $( "<li>Open: " + (new Date() - start) + "ms</li>" ).appendTo( "#log" );
}); });
</script> </script>
</head> </head>

View File

@ -12,11 +12,12 @@
} }
</style> </style>
<script src="../../../external/requirejs/require.js"></script> <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 ) { $( "pre" ).each(function( index, elem ) {
$( elem ) $( elem )
.attr( "title", "animated tooltips" ) .attr( "title", "animated tooltips" )
.tooltip( $.parseJSON( $( elem ).text() ) ); .tooltip( JSON.parse( $( elem ).text() ) );
}); });
</script> </script>
</head> </head>

View File

@ -13,7 +13,7 @@
padding: 0; padding: 0;
margin: 0; margin: 0;
display: block; display: block;
outline: none; outline: 0;
} }
.ui-menu .ui-menu { .ui-menu .ui-menu {
position: absolute; position: absolute;

View File

@ -33,10 +33,18 @@
.ui-selectmenu-open { .ui-selectmenu-open {
display: block; display: block;
} }
.ui-selectmenu-button.ui-button { .ui-selectmenu-text {
text-align: left; display: block;
margin-right: 20px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
}
.ui-selectmenu-button.ui-button {
text-align: left;
white-space: nowrap; white-space: nowrap;
width: 14em; width: 14em;
} }
.ui-selectmenu-icon.ui-icon {
float: right;
margin-top: 0;
}

View File

@ -7,7 +7,7 @@
* http://jquery.org/license * http://jquery.org/license
*/ */
//>>label: :data //>>label: :data Selector
//>>group: Core //>>group: Core
//>>description: Selects elements which have data stored under the specified key. //>>description: Selects elements which have data stored under the specified key.
//>>docs: http://api.jqueryui.com/data-selector/ //>>docs: http://api.jqueryui.com/data-selector/

View File

@ -7,7 +7,7 @@
* http://jquery.org/license * http://jquery.org/license
*/ */
//>>label: focusable //>>label: :focusable Selector
//>>group: Core //>>group: Core
//>>description: Selects elements which can be focused. //>>description: Selects elements which can be focused.
//>>docs: http://api.jqueryui.com/focusable-selector/ //>>docs: http://api.jqueryui.com/focusable-selector/

View File

@ -7,7 +7,7 @@
* http://jquery.org/license * http://jquery.org/license
*/ */
//>>label: focusable //>>label: :tabbable Selector
//>>group: Core //>>group: Core
//>>description: Selects elements which can be tabbed to. //>>description: Selects elements which can be tabbed to.
//>>docs: http://api.jqueryui.com/tabbable-selector/ //>>docs: http://api.jqueryui.com/tabbable-selector/

View File

@ -373,7 +373,14 @@ return $.widget( "ui.accordion", {
maxHeight = 0; maxHeight = 0;
this.headers.next() this.headers.next()
.each( function() { .each( function() {
var isVisible = $( this ).is( ":visible" );
if ( !isVisible ) {
$( this ).show();
}
maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
if ( !isVisible ) {
$( this ).hide();
}
} ) } )
.height( maxHeight ); .height( maxHeight );
} }

View File

@ -82,7 +82,7 @@ $.widget( "ui.autocomplete", {
// Inputs are always single-line, even if inside a contentEditable element // Inputs are always single-line, even if inside a contentEditable element
// IE also treats inputs as contentEditable // IE also treats inputs as contentEditable
// All other element types are determined by whether or not they're 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.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ];
this.isNewMenu = true; this.isNewMenu = true;
@ -614,6 +614,24 @@ $.widget( "ui.autocomplete", {
// Prevents moving cursor to beginning/end of the text field in some browsers // Prevents moving cursor to beginning/end of the text field in some browsers
event.preventDefault(); 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";
} }
} ); } );

View File

@ -115,8 +115,10 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
if ( checked ) { if ( checked ) {
this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" );
if ( this.icon ) {
this._addClass( this.icon, null, "ui-state-hover" ); this._addClass( this.icon, null, "ui-state-hover" );
} }
}
this._on( { this._on( {
change: "_toggleClasses", change: "_toggleClasses",

View File

@ -143,14 +143,19 @@ $.widget( "ui.draggable", $.ui.mouse, {
}, },
_blurActiveElement: function( event ) { _blurActiveElement: function( event ) {
var activeElement = $.ui.safeActiveElement( this.document[ 0 ] ),
target = $( event.target );
// Only need to blur if the event occurred on the draggable itself, see #10527 // Only blur if the event occurred on an element that is:
if ( !this.handleElement.is( event.target ) ) { // 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; return;
} }
// Blur any element that currently has focus, see #4261 // Blur any element that currently has focus, see #4261
$.ui.safeBlur( $.ui.safeActiveElement( this.document[ 0 ] ) ); $.ui.safeBlur( activeElement );
}, },
_mouseStart: function( event ) { _mouseStart: function( event ) {

View File

@ -270,7 +270,7 @@ return $.widget( "ui.menu", {
}, },
_activate: function( event ) { _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 ) { if ( this.active.children( "[aria-haspopup='true']" ).length ) {
this.expand( event ); this.expand( event );
} else { } else {
@ -487,6 +487,10 @@ return $.widget( "ui.menu", {
this._close( currentMenu ); this._close( currentMenu );
this.blur( event ); 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.activeMenu = currentMenu;
}, this.delay ); }, this.delay );
}, },
@ -498,14 +502,10 @@ return $.widget( "ui.menu", {
startMenu = this.active ? this.active.parent() : this.element; startMenu = this.active ? this.active.parent() : this.element;
} }
var active = startMenu startMenu.find( ".ui-menu" )
.find( ".ui-menu" )
.hide() .hide()
.attr( "aria-hidden", "true" ) .attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" ) .attr( "aria-expanded", "false" );
.end()
.find( ".ui-state-active" ).not( ".ui-menu-item-wrapper" );
this._removeClass( active, null, "ui-state-active" );
}, },
_closeOnDocumentClick: function( event ) { _closeOnDocumentClick: function( event ) {

View File

@ -99,9 +99,9 @@ $.widget( "ui.resizable", $.ui.mouse, {
_create: function() { _create: function() {
var n, i, handle, axis, hname, margins, var margins,
that = this, o = this.options,
o = this.options; that = this;
this._addClass( "ui-resizable" ); this._addClass( "ui-resizable" );
$.extend( this, { $.extend( this, {
@ -159,6 +159,80 @@ $.widget( "ui.resizable", $.ui.mouse, {
this._proportionallyResize(); 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 || this.handles = o.handles ||
( !$( ".ui-resizable-handle", this.element ).length ? ( !$( ".ui-resizable-handle", this.element ).length ?
"e,s,se" : { "e,s,se" : {
@ -250,60 +324,11 @@ $.widget( "ui.resizable", $.ui.mouse, {
if ( o.autoHide ) { if ( o.autoHide ) {
this._handles.hide(); this._handles.hide();
this._addClass( "ui-resizable-autohide" ); 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() { _removeHandles: function() {
this._handles.remove();
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;
}, },
_mouseCapture: function( event ) { _mouseCapture: function( event ) {
@ -582,7 +607,7 @@ $.widget( "ui.resizable", $.ui.mouse, {
isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
dw = this.originalPosition.left + this.originalSize.width, 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 ); cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
if ( isminw ) { if ( isminw ) {
data.width = o.minWidth; data.width = o.minWidth;

View File

@ -84,7 +84,7 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
}, },
_drawButton: function() { _drawButton: function() {
var icon, space, var icon,
that = this, that = this,
item = this._parseOption( item = this._parseOption(
this.element.find( "option:selected" ), 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", this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
"ui-button ui-widget" ); "ui-button ui-widget" );
icon = $( "<span>" ).prependTo( this.button ); icon = $( "<span>" ).appendTo( this.button );
space = $( "<span> </span>" ); this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
this._addClass( space, "ui-selectmenu-icon-space" );
this._addClass( icon, null, "ui-icon " + this.options.icons.button );
icon.after( space );
this.buttonItem = this._renderButtonItem( item ) this.buttonItem = this._renderButtonItem( item )
.appendTo( this.button ); .appendTo( this.button );

View File

@ -544,8 +544,13 @@ return $.widget( "ui.slider", $.ui.mouse, {
var max = this.options.max, var max = this.options.max,
min = this._valueMin(), min = this._valueMin(),
step = this.options.step, step = this.options.step,
aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step; aboveMin = Math.round( ( max - min ) / step ) * step;
max = aboveMin + min; 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() ) ); this.max = parseFloat( max.toFixed( this._precision() ) );
}, },

View File

@ -908,7 +908,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
floating = innermostContainer.floating || this._isFloating( this.currentItem ); floating = innermostContainer.floating || this._isFloating( this.currentItem );
posProperty = floating ? "left" : "top"; posProperty = floating ? "left" : "top";
sizeProperty = floating ? "width" : "height"; sizeProperty = floating ? "width" : "height";
axis = floating ? "clientX" : "clientY"; axis = floating ? "pageX" : "pageY";
for ( j = this.items.length - 1; j >= 0; j-- ) { for ( j = this.items.length - 1; j >= 0; j-- ) {
if ( !$.contains( this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) ) { 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.left - this.offset.parent.left,
0 - this.offset.relative.top - this.offset.parent.top, 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.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
]; ];
} }