Skip to content

Commit 6640925

Browse files
committed
Merge branch 'master' into selectmenu
2 parents f96ee5e + 5c0a6aa commit 6640925

File tree

12 files changed

+78
-35
lines changed

12 files changed

+78
-35
lines changed

build/tasks/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ grunt.registerTask( "manifest", "Generate jquery.json manifest files", function(
3939
name: "ui.effect-{plugin}",
4040
title: "jQuery UI {Plugin} Effect",
4141
keywords: [ "effect", "show", "hide" ],
42-
homepage: "http://jqueryui.com/{plugin}-effect/",
43-
demo: "http://jqueryui.com/{plugin}-effect/",
42+
homepage: "http://jqueryui.com/effect/",
43+
demo: "http://jqueryui.com/effect/",
4444
docs: "http://api.jqueryui.com/{plugin}-effect/",
4545
dependencies: [ "effect" ]
4646
}

demos/position/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
</select>
9696
<select id="my_vertical">
9797
<option value="top">top</option>
98-
<option value="middle">center</option>
98+
<option value="center">center</option>
9999
<option value="bottom">bottom</option>
100100
</select>
101101
</div>
@@ -108,7 +108,7 @@
108108
</select>
109109
<select id="at_vertical">
110110
<option value="top">top</option>
111-
<option value="middle">center</option>
111+
<option value="center">center</option>
112112
<option value="bottom">bottom</option>
113113
</select>
114114
</div>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "jquery-ui",
33
"title": "jQuery UI",
44
"description": "A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.",
5-
"version": "1.10.3pre",
5+
"version": "1.11.0pre",
66
"homepage": "http://jqueryui.com",
77
"author": {
88
"name": "jQuery Foundation and other contributors",

tests/unit/autocomplete/autocomplete_core.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,30 @@ test( "allow form submit on enter when menu is not active", function() {
8989
test( "down arrow moves focus - contenteditable", function() {
9090
arrowsMoveFocus( "#autocomplete-contenteditable", false );
9191
});
92+
93+
test( "up arrow moves cursor - input", function() {
94+
arrowsNavigateElement( "#autocomplete", true, false );
95+
});
96+
97+
test( "down arrow moves cursor - input", function() {
98+
arrowsNavigateElement( "#autocomplete", false, false );
99+
});
100+
101+
test( "up arrow moves cursor - textarea", function() {
102+
arrowsNavigateElement( "#autocomplete-textarea", true, true );
103+
});
104+
105+
test( "down arrow moves cursor - textarea", function() {
106+
arrowsNavigateElement( "#autocomplete-textarea", false, true );
107+
});
108+
109+
test( "up arrow moves cursor - contenteditable", function() {
110+
arrowsNavigateElement( "#autocomplete-contenteditable", true, true );
111+
});
112+
113+
test( "down arrow moves cursor - contenteditable", function() {
114+
arrowsNavigateElement( "#autocomplete-contenteditable", false, true );
115+
});
92116

93117
function arrowsInvokeSearch( id, isKeyUp, shouldMove ) {
94118
expect( 1 );
@@ -120,6 +144,23 @@ test( "allow form submit on enter when menu is not active", function() {
120144
element.autocomplete( "search" );
121145
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
122146
}
147+
148+
function arrowsNavigateElement( id, isKeyUp, shouldMove ) {
149+
expect( 1 );
150+
151+
var didMove = false,
152+
element = $( id ).autocomplete({
153+
source: [ "a" ],
154+
delay: 0,
155+
minLength: 0
156+
});
157+
element.on( "keypress", function( e ) {
158+
didMove = !e.isDefaultPrevented();
159+
});
160+
element.simulate( "keydown", { keyCode: ( isKeyUp ? $.ui.keyCode.UP : $.ui.keyCode.DOWN ) } );
161+
element.simulate( "keypress" );
162+
equal( didMove, shouldMove, "respond to arrow" );
163+
}
123164
})();
124165

125166
asyncTest( "handle race condition", function() {

themes/base/jquery.ui.menu.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
margin: 0;
2424
padding: 0;
2525
width: 100%;
26+
/* support: IE10, see #8844 */
27+
list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
2628
}
2729
.ui-menu .ui-menu-divider {
2830
margin: 5px -2px 5px -2px;

ui/jquery.ui.accordion.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ $.widget( "ui.accordion", {
169169
},
170170

171171
_keydown: function( event ) {
172-
/*jshint maxcomplexity:15*/
173172
if ( event.altKey || event.ctrlKey ) {
174173
return;
175174
}

ui/jquery.ui.autocomplete.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
*/
1717
(function( $, undefined ) {
1818

19-
// used to prevent race conditions with remote data sources
20-
var requestIndex = 0;
21-
2219
$.widget( "ui.autocomplete", {
2320
version: "@VERSION",
2421
defaultElement: "<input>",
@@ -77,7 +74,6 @@ $.widget( "ui.autocomplete", {
7774

7875
this._on( this.element, {
7976
keydown: function( event ) {
80-
/*jshint maxcomplexity:15*/
8177
if ( this.element.prop( "readOnly" ) ) {
8278
suppressKeyPress = true;
8379
suppressInput = true;
@@ -142,7 +138,9 @@ $.widget( "ui.autocomplete", {
142138
keypress: function( event ) {
143139
if ( suppressKeyPress ) {
144140
suppressKeyPress = false;
145-
event.preventDefault();
141+
if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
142+
event.preventDefault();
143+
}
146144
return;
147145
}
148146
if ( suppressKeyPressRepeat ) {
@@ -417,21 +415,24 @@ $.widget( "ui.autocomplete", {
417415
this.source( { term: value }, this._response() );
418416
},
419417

420-
_response: function() {
421-
var that = this,
422-
index = ++requestIndex;
418+
_response: (function() {
419+
var requestIndex = 0;
423420

424-
return function( content ) {
425-
if ( index === requestIndex ) {
426-
that.__response( content );
427-
}
421+
return function() {
422+
var index = ++requestIndex;
428423

429-
that.pending--;
430-
if ( !that.pending ) {
431-
that.element.removeClass( "ui-autocomplete-loading" );
432-
}
424+
return $.proxy(function( content ) {
425+
if ( index === requestIndex ) {
426+
this.__response( content );
427+
}
428+
429+
this.pending--;
430+
if ( !this.pending ) {
431+
this.element.removeClass( "ui-autocomplete-loading" );
432+
}
433+
}, this );
433434
};
434-
},
435+
})(),
435436

436437
__response: function( content ) {
437438
if ( content ) {

ui/jquery.ui.dialog.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,6 @@ $.widget( "ui.dialog", {
556556
},
557557

558558
_setOption: function( key, value ) {
559-
/*jshint maxcomplexity:15*/
560559
var isDraggable, isResizable,
561560
uiDialog = this.uiDialog;
562561

ui/jquery.ui.menu.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ $.widget( "ui.menu", {
174174
},
175175

176176
_keydown: function( event ) {
177-
/*jshint maxcomplexity:20*/
178177
var match, prev, character, skip, regex,
179178
preventDefault = true;
180179

ui/jquery.ui.slider.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ $.widget( "ui.slider", $.ui.mouse, {
593593

594594
_handleEvents: {
595595
keydown: function( event ) {
596-
/*jshint maxcomplexity:25*/
597596
var allowed, curVal, newVal, step,
598597
index = $( event.target ).data( "ui-slider-handle-index" );
599598

0 commit comments

Comments
 (0)