Skip to content

Commit 88ec776

Browse files
committed
Merge remote branch 'origin/master'
2 parents 4be0942 + 5debdb0 commit 88ec776

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+273
-113
lines changed

demos/addClass/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.toggler { width: 500px; height: 200px; position: relative;}
1212
#button { padding: .5em 1em; text-decoration: none; }
1313
#effect { width: 240px; padding: 1em; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
14-
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
14+
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
1515
</style>
1616
<script type="text/javascript">
1717
$(function() {

demos/autocomplete/combobox.html

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
minLength: 0
5555
})
5656
.addClass("ui-widget ui-widget-content ui-corner-left");
57+
input.data("autocomplete")._renderItem = function( ul, item) {
58+
return $( "<li></li>" )
59+
.data( "item.autocomplete", item )
60+
.append( "<a>" + item.label + "</a>" )
61+
.appendTo( ul );
62+
};
5763
$("<button>&nbsp;</button>")
5864
.attr("tabIndex", -1)
5965
.attr("title", "Show All Items")
@@ -96,19 +102,28 @@
96102
<label>Your preferred programming language: </label>
97103
<select id="combobox">
98104
<option value="">Select one...</option>
99-
<option value="a">asp</option>
100-
<option value="c">c</option>
101-
<option value="cpp">c++</option>
102-
<option value="cf">coldfusion</option>
103-
<option value="g">groovy</option>
104-
<option value="h">haskell</option>
105-
<option value="j">java</option>
106-
<option value="js">javascript</option>
107-
<option value="p1">perl</option>
108-
<option value="p2">php</option>
109-
<option value="p3">python</option>
110-
<option value="r">ruby</option>
111-
<option value="s">scala</option>
105+
<option value="ActionScript">ActionScript</option>
106+
<option value="AppleScript">AppleScript</option>
107+
<option value="Asp">Asp</option>
108+
<option value="BASIC">BASIC</option>
109+
<option value="C">C</option>
110+
<option value="C++">C++</option>
111+
<option value="Clojure">Clojure</option>
112+
<option value="COBOL">COBOL</option>
113+
<option value="ColdFusion">ColdFusion</option>
114+
<option value="Erlang">Erlang</option>
115+
<option value="Fortran">Fortran</option>
116+
<option value="Groovy">Groovy</option>
117+
<option value="Haskell">Haskell</option>
118+
<option value="Java">Java</option>
119+
<option value="JavaScript">JavaScript</option>
120+
<option value="Lisp">Lisp</option>
121+
<option value="Perl">Perl</option>
122+
<option value="PHP">PHP</option>
123+
<option value="Python">Python</option>
124+
<option value="Ruby">Ruby</option>
125+
<option value="Scala">Scala</option>
126+
<option value="Scheme">Scheme</option>
112127
</select>
113128
</div>
114129
<button id="toggle">Show underlying select</button>

demos/autocomplete/custom-data.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
$('#project').val(ui.item.label);
6161
$('#project-id').val(ui.item.value);
6262
$('#project-description').html(ui.item.desc);
63-
$('#project-icon').attr('src', '../images/' + ui.item.icon);
63+
$('#project-icon').attr('src', 'images/' + ui.item.icon);
6464

6565
return false;
6666
}
@@ -78,7 +78,7 @@
7878

7979
<div class="demo">
8080
<div id="project-label">Select a project (type "j" for a start):</div>
81-
<img id="project-icon" src="../images/transparent_1x1.png" class="ui-state-default"/>
81+
<img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default"/>
8282
<input id="project"/>
8383
<input type="hidden" id="project-id"/>
8484
<p id="project-description"></p>

demos/autocomplete/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
1313
<script type="text/javascript">
1414
$(function() {
15-
var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
15+
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
1616
$("#tags").autocomplete({
1717
source: availableTags
1818
});

demos/autocomplete/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ <h4>Examples</h4>
1313
<li><a href="remote.html">Remote datasource</a></li>
1414
<li><a href="remote-with-cache.html">Remote with caching</a></li>
1515
<li><a href="remote-jsonp.html">Remote JSONP datasource</a></li>
16+
<li><a href="maxheight.html">Scrollable results</a></li>
1617
<li><a href="combobox.html">Combobox</a></li>
1718
<li><a href="custom-data.html">Custom data and display</a></li>
1819
<li><a href="xml.html">XML data parsed once</a></li>
1920
<li><a href="categories.html">Categories</a></li>
21+
<li><a href="folding.html">Accent folding</a></li>
2022
<li><a href="multiple.html">Multiple values</a></li>
2123
<li><a href="multiple-remote.html">Multiple, remote</a></li>
2224
</ul>

demos/autocomplete/maxheight.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>jQuery UI Autocomplete Scrollable Results Demo</title>
6+
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
7+
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
8+
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
9+
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
10+
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
11+
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
12+
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete {
15+
max-height: 100px;
16+
overflow-y: auto;
17+
}
18+
/* IE 6 doesn't support max-height
19+
* we use height instead, but this forces the menu to always be this tall
20+
*/
21+
* html .ui-autocomplete {
22+
height: 100px;
23+
}
24+
</style>
25+
<script type="text/javascript">
26+
$(function() {
27+
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
28+
$("#tags").autocomplete({
29+
source: availableTags
30+
});
31+
});
32+
</script>
33+
</head>
34+
<body>
35+
36+
<div class="demo">
37+
38+
<div class="ui-widget">
39+
<label for="tags">Tags: </label>
40+
<input id="tags" />
41+
</div>
42+
43+
</div><!-- End demo -->
44+
45+
<div class="demo-description">
46+
<p>
47+
When displaying a long list of options, you can simply set the max-height for the autocomplete menu to prevent the menu from growing too large. Try typing "a" or "s" above to get a long list of results that you can scroll through.
48+
</p>
49+
</div><!-- End demo-description -->
50+
51+
</body>
52+
</html>

demos/autocomplete/multiple-remote.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
1111
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
15+
</style>
1316
<script type="text/javascript">
1417
$(function() {
1518
function split(val) {

demos/autocomplete/multiple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
1313
<script type="text/javascript">
1414
$(function() {
15-
var availableTags = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
15+
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
1616
function split(val) {
1717
return val.split(/,\s*/);
1818
}

demos/autocomplete/remote-jsonp.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
1111
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
15+
</style>
1316
<script type="text/javascript">
1417
$(function() {
1518
function log(message) {

demos/autocomplete/remote-with-cache.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
1111
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
15+
</style>
1316
<script type="text/javascript">
1417
$(function() {
1518
var cache = {};

demos/autocomplete/remote.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
1111
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
15+
</style>
1316
<script type="text/javascript">
1417
$(function() {
1518
function log(message) {

demos/autocomplete/search.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
$q = strtolower($_GET["term"]);
44
if (!$q) return;
55
$items = array(
6-
"Great <em>Bittern</em>"=>"Botaurus stellaris",
7-
"Little <em>Grebe</em>"=>"Tachybaptus ruficollis",
6+
"Great Bittern"=>"Botaurus stellaris",
7+
"Little Grebe"=>"Tachybaptus ruficollis",
88
"Black-necked Grebe"=>"Podiceps nigricollis",
99
"Little Bittern"=>"Ixobrychus minutus",
1010
"Black-crowned Night Heron"=>"Nycticorax nycticorax",

demos/autocomplete/xml.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
1111
<script type="text/javascript" src="../../ui/jquery.ui.autocomplete.js"></script>
1212
<link type="text/css" href="../demos.css" rel="stylesheet" />
13+
<style type="text/css">
14+
.ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; }
15+
</style>
1316
<script type="text/javascript">
1417
$(function() {
1518
function log(message) {

demos/removeClass/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.toggler { width: 500px; height: 200px; position: relative;}
1212
#button { padding: .5em 1em; text-decoration: none; }
1313
#effect {position: relative; width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
14-
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
14+
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
1515
</style>
1616
<script type="text/javascript">
1717
$(function() {

demos/switchClass/default.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
.toggler { width: 500px; height: 200px; position: relative;}
1212
#button { padding: .5em 1em; text-decoration: none; }
1313
#effect {position: relative; }
14-
#effect.newClass { width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; }
15-
#effect.anotherNewClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
14+
.newClass { width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; margin: 0; }
15+
.anotherNewClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
1616
</style>
1717
<script type="text/javascript">
1818
$(function() {

demos/toggleClass/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
.toggler { width: 500px; height: 200px; position: relative;}
1212
#button { padding: .5em 1em; text-decoration: none; }
1313
#effect {position: relative; width: 240px; padding: 1em; letter-spacing: 0; font-size: 1.2em; border: 1px solid #000; background: #eee; color: #333; }
14-
#effect.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
14+
.newClass { text-indent: 40px; letter-spacing: .4em; width: 410px; height: 100px; padding: 30px; margin: 10px; font-size: 1.6em; }
1515
</style>
1616
<script type="text/javascript">
1717
$(function() {

tests/unit/autocomplete/autocomplete_defaults.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ var autocomplete_defaults = {
66
delay: 300,
77
disabled: false,
88
minLength: 1,
9-
source: undefined
9+
position: {
10+
my: "left top",
11+
at: "left bottom",
12+
collision: "none"
13+
},
14+
source: null
1015
};
1116

1217
commonWidgetTests('autocomplete', { defaults: autocomplete_defaults });

tests/unit/dialog/dialog_options.js

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,25 @@ test("modal", function() {
242242

243243
test("position, default center on window", function() {
244244
var el = $('<div></div>').dialog();
245-
var offset = el.parent().offset();
246-
// use .position() instead to avoid replicating center-logic?
245+
var dialog = el.dialog('widget');
246+
var offset = dialog.offset();
247247
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
248248
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
249249
el.remove();
250250
});
251251

252252
test("position, top on window", function() {
253253
var el = $('<div></div>').dialog({ position: "top" });
254-
var dialog = el.closest('.ui-dialog');
254+
var dialog = el.dialog('widget');
255255
var offset = dialog.offset();
256-
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2));
256+
same(offset.left, Math.floor($(window).width() / 2 - dialog.outerWidth() / 2) + $(window).scrollLeft());
257257
same(offset.top, $(window).scrollTop());
258258
el.remove();
259259
});
260260

261261
test("position, left on window", function() {
262262
var el = $('<div></div>').dialog({ position: "left" });
263-
var dialog = el.closest('.ui-dialog');
263+
var dialog = el.dialog('widget');
264264
var offset = dialog.offset();
265265
same(offset.left, 0);
266266
same(offset.top, Math.floor($(window).height() / 2 - dialog.outerHeight() / 2) + $(window).scrollTop());
@@ -269,27 +269,27 @@ test("position, left on window", function() {
269269

270270
test("position, right bottom on window", function() {
271271
var el = $('<div></div>').dialog({ position: "right bottom" });
272-
var dialog = el.closest('.ui-dialog');
272+
var dialog = el.dialog('widget');
273273
var offset = dialog.offset();
274-
same(offset.left, $(window).width() - dialog.outerWidth());
274+
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
275275
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
276276
el.remove();
277277
});
278278

279279
test("position, right bottom on window w/array", function() {
280280
var el = $('<div></div>').dialog({ position: ["right", "bottom"] });
281-
var dialog = el.closest('.ui-dialog');
281+
var dialog = el.dialog('widget');
282282
var offset = dialog.offset();
283-
same(offset.left, $(window).width() - dialog.outerWidth());
283+
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
284284
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
285285
el.remove();
286286
});
287287

288288
test("position, offset from top left w/array", function() {
289289
var el = $('<div></div>').dialog({ position: [10, 10] });
290-
var dialog = el.closest('.ui-dialog');
290+
var dialog = el.dialog('widget');
291291
var offset = dialog.offset();
292-
same(offset.left, 10);
292+
same(offset.left, 10 + $(window).scrollLeft());
293293
same(offset.top, 10 + $(window).scrollTop());
294294
el.remove();
295295
});
@@ -302,10 +302,10 @@ test("position, right bottom at right bottom via ui.position args", function() {
302302
}
303303
});
304304

305-
var dialog = el.closest('.ui-dialog');
305+
var dialog = el.dialog('widget');
306306
var offset = dialog.offset();
307307

308-
same(offset.left, $(window).width() - dialog.outerWidth());
308+
same(offset.left, $(window).width() - dialog.outerWidth() + $(window).scrollLeft());
309309
same(offset.top, $(window).height() - dialog.outerHeight() + $(window).scrollTop());
310310
el.remove();
311311
});
@@ -317,41 +317,37 @@ test("position, at another element", function() {
317317
left: 600,
318318
height: 10,
319319
width: 10
320-
});
320+
}).appendTo('body');
321321

322322
var el = $('<div></div>').dialog({
323323
position: {
324324
my: "left top",
325-
at: "top left",
325+
at: "left top",
326326
of: parent
327327
}
328328
});
329329

330-
var dialog = el.closest('.ui-dialog');
330+
var dialog = el.dialog('widget');
331331
var offset = dialog.offset();
332-
var parentOffset = parent.offset();
333332

334-
same(offset.left, parentOffset.left);
335-
same(offset.top, parentOffset.top);
333+
same(offset.left, 600);
334+
same(offset.top, 400);
336335

337336
el.dialog('option', 'position', {
338337
my: "left top",
339338
at: "right bottom",
340339
of: parent
341340
});
342341

343-
same(offset.left, parentOffset.left + parent.outerWidth());
344-
same(offset.top, parentOffset.top + parent.outerHeight());
342+
var offset = dialog.offset();
343+
344+
same(offset.left, 610);
345+
same(offset.top, 410);
345346

346347
el.remove();
347348
parent.remove();
348349
});
349350

350-
351-
test("position, others", function() {
352-
ok(false, 'missing test - untested code is broken code');
353-
});
354-
355351
test("resizable", function() {
356352
expect(4);
357353

0 commit comments

Comments
 (0)