mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Merge branch 'master' into datepicker
This commit is contained in:
commit
b92f1b0f2f
2
.mailmap
2
.mailmap
@ -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>
|
||||
|
@ -1,4 +1,5 @@
|
||||
sudo: false
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.12"
|
||||
|
11
AUTHORS.txt
11
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
|
||||
|
21
Gruntfile.js
21
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)";
|
||||
|
@ -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
|
||||
|
@ -44,7 +44,7 @@
|
||||
</script>
|
||||
<style>
|
||||
h2 {
|
||||
margin: 30px 0 0 0
|
||||
margin: 30px 0 0 0;
|
||||
}
|
||||
fieldset {
|
||||
border: 0;
|
||||
|
27
package.json
27
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": []
|
||||
|
@ -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>
|
||||
|
@ -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( {
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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 );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
@ -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>" )
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -13,7 +13,7 @@
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: block;
|
||||
outline: none;
|
||||
outline: 0;
|
||||
}
|
||||
.ui-menu .ui-menu {
|
||||
position: absolute;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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/
|
||||
|
@ -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/
|
||||
|
@ -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/
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -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( {
|
||||
|
@ -143,14 +143,19 @@ $.widget( "ui.draggable", $.ui.mouse, {
|
||||
},
|
||||
|
||||
_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
|
||||
if ( !this.handleElement.is( 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 ) {
|
||||
|
@ -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 ) {
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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() ) );
|
||||
},
|
||||
|
||||
|
@ -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
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user