aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgnarf <gnarf@gnarf.net>2011-05-10 16:16:34 -0500
committergnarf <gnarf@gnarf.net>2011-05-10 16:16:34 -0500
commit27a7deebf299e1673e8b452476be02e486bba2c6 (patch)
tree79521a78ab770ebd7ee167575b680f14d3ed4089
parent4dcfeee8d54d81db4d5af8b2fd189b799cd9561e (diff)
parent85ac420a1e4281ee7f361e847d3cad72fa58525e (diff)
downloadjquery-ui-27a7deebf299e1673e8b452476be02e486bba2c6.tar.gz
jquery-ui-27a7deebf299e1673e8b452476be02e486bba2c6.zip
Merge branch 'master' into effects-unit
Conflicts: ui/jquery.effects.pulsate.js
-rw-r--r--README.md17
-rw-r--r--demos/autocomplete/combobox.html62
-rw-r--r--demos/demos.css3
-rw-r--r--demos/index.html4
-rw-r--r--demos/menu/contextmenu.html48
-rw-r--r--demos/menu/default.html12
-rw-r--r--demos/menu/index.html2
-rw-r--r--demos/menubar/default.html (renamed from tests/visual/menu/menubar.html)48
-rw-r--r--demos/menubar/index.html16
-rw-r--r--demos/popup/default.html83
-rw-r--r--demos/popup/index.html18
-rw-r--r--demos/popup/popup-menu-table.html108
-rw-r--r--demos/popup/popup-menu.html98
-rw-r--r--demos/resizable/constrain-area.html2
-rw-r--r--demos/tooltip/video-player.html71
-rw-r--r--tests/unit/autocomplete/autocomplete_events.js16
-rw-r--r--tests/unit/datepicker/datepicker.html1
-rw-r--r--tests/unit/datepicker/datepicker_core.js8
-rw-r--r--tests/unit/datepicker/datepicker_options.js4
-rw-r--r--tests/unit/tabs/spinner.gifbin1387 -> 0 bytes
-rw-r--r--tests/unit/tabs/tabs.html1
-rw-r--r--tests/unit/tabs/tabs_core.js28
-rw-r--r--tests/unit/tabs/tabs_deprecated.html1
-rw-r--r--tests/unit/tabs/tabs_deprecated.js302
-rw-r--r--tests/unit/tabs/tabs_events.js92
-rw-r--r--tests/unit/tabs/tabs_methods.js17
-rw-r--r--tests/unit/tabs/tabs_options.js83
-rw-r--r--tests/unit/tabs/tabs_tickets.js37
-rw-r--r--tests/visual/effects.all.html12
-rw-r--r--tests/visual/effects.all.js20
-rw-r--r--tests/visual/menu/contextmenu.html191
-rw-r--r--tests/visual/menu/menubar.js234
-rw-r--r--tests/visual/menu/popup.html176
-rw-r--r--tests/visual/menu/popup.js124
-rw-r--r--ui/i18n/jquery.ui.datepicker-af.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ar.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-az.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-bg.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-bs.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-cs.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-da.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-de.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-el.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-en-GB.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-eo.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-et.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-eu.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-fa.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-fo.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-fr-CH.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-fr.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-he.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-hr.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ja.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ml.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-nl.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ro.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-sq.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-sr-SR.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-sr.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-sv.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-ta.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-th.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-vi.js2
-rw-r--r--ui/i18n/jquery.ui.datepicker-zh-TW.js2
-rw-r--r--ui/jquery.effects.bounce.js6
-rw-r--r--ui/jquery.effects.pulsate.js6
-rw-r--r--ui/jquery.ui.autocomplete.js28
-rw-r--r--ui/jquery.ui.button.js5
-rw-r--r--ui/jquery.ui.datepicker.js29
-rw-r--r--ui/jquery.ui.dialog.js2
-rw-r--r--ui/jquery.ui.menu.js4
-rw-r--r--ui/jquery.ui.menubar.js272
-rw-r--r--ui/jquery.ui.mouse.js12
-rw-r--r--ui/jquery.ui.popup.js174
-rw-r--r--ui/jquery.ui.resizable.js2
-rw-r--r--[-rwxr-xr-x]ui/jquery.ui.tabs.js165
-rw-r--r--ui/jquery.ui.tooltip.js3
78 files changed, 1556 insertions, 1153 deletions
diff --git a/README.md b/README.md
index 5c7d79a13..9a0d7c5c5 100644
--- a/README.md
+++ b/README.md
@@ -7,3 +7,20 @@ If you want to use jQuery UI, go to [jqueryui.com](http://jqueryui.com) to get s
If you are interested in helping developing jQuery UI, you are in the right place.
To discuss development with team members and the community, visit the [Developing jQuery UI Forum](http://forum.jquery.com/developing-jquery-ui).
+
+For commiters
+---
+When looking at pull requests, first check for [proper commit messages](http://wiki.jqueryui.com/w/page/12137724/Bug-Fixing-Guide).
+
+Unless everything is fine and you can merge directly via GitHub's interface, fetch the remote first:
+
+ git remote add [username] [his-fork.git] -f
+
+If you want just one commit and edit the commit message:
+
+ git cherry-pick -e [sha-of-commit]
+
+If it should go to the stable brach, cherry-pick it to stable:
+
+ git checkout 1-8-stable
+ git cherry-pick -x [sha-of-commit]
diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html
index ded809e1e..5fb3ffef9 100644
--- a/demos/autocomplete/combobox.html
+++ b/demos/autocomplete/combobox.html
@@ -16,7 +16,7 @@
<style>
.ui-button { margin-left: -1px; }
.ui-button-icon-only .ui-button-text { padding: 0.35em; }
- .ui-autocomplete-input { margin: 0; padding: 0.48em 0 0.47em 0.45em; }
+ .ui-autocomplete-input { margin: 0; padding: 0.4em 0 0.4em 0.45em; }
</style>
<script>
(function( $ ) {
@@ -26,6 +26,32 @@
select = this.element.hide(),
selected = select.children( ":selected" ),
value = selected.val() ? selected.text() : "";
+
+ function removeIfInvalid(element) {
+ var value = $( element ).val(),
+ matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
+ valid = false;
+ select.children( "option" ).each(function() {
+ if ( $( this ).text().match( matcher ) ) {
+ this.selected = valid = true;
+ return false;
+ }
+ });
+ if ( !valid ) {
+ // remove invalid value, as it didn't match anything
+ $( element )
+ .val( "" )
+ .attr( "title", value + " didn't match any item" )
+ .tooltip( "open" );
+ select.val( "" );
+ setTimeout(function() {
+ input.tooltip( "close" ).attr( "title", "" );
+ }, 2500 );
+ input.data( "autocomplete" ).term = "";
+ return false;
+ }
+ }
+
var input = this.input = $( "<input>" )
.insertAfter( select )
.val( value )
@@ -57,30 +83,8 @@
});
},
change: function( event, ui ) {
- if ( !ui.item ) {
- var value = $( this ).val(),
- matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
- valid = false;
- select.children( "option" ).each(function() {
- if ( $( this ).text().match( matcher ) ) {
- this.selected = valid = true;
- return false;
- }
- });
- if ( !valid ) {
- // remove invalid value, as it didn't match anything
- $( this )
- .val( "" )
- .attr( "title", value + " didn't match any item" )
- .tooltip( "open" );
- select.val( "" );
- setTimeout(function() {
- input.tooltip( "close" ).attr( "title", "" );
- }, 2500 );
- input.data( "autocomplete" ).term = "";
- return false;
- }
- }
+ if ( !ui.item )
+ return removeIfInvalid( this );
}
})
.addClass( "ui-widget ui-widget-content ui-corner-left" );
@@ -109,6 +113,7 @@
// close if already visible
if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
input.autocomplete( "close" );
+ removeIfInvalid( input );
return;
}
@@ -124,10 +129,9 @@
.tooltip({
position: {
of: this.button
- }
- })
- .tooltip( "widget" )
- .addClass( "ui-state-highlight" );
+ },
+ tooltipClass: "ui-state-highlight"
+ });
},
destroy: function() {
diff --git a/demos/demos.css b/demos/demos.css
index f5f2dbe64..cf6da8bd1 100644
--- a/demos/demos.css
+++ b/demos/demos.css
@@ -129,8 +129,7 @@ eventually we should convert the font sizes to ems -- using px for now to minimi
.normal h3.demo-header { font-size:32px; padding:0 0 5px; border-bottom:1px solid #eee; text-transform: capitalize; }
.normal h4.demo-subheader { font-size:10px; text-transform: uppercase; color:#999; padding:8px 0 3px; border:0; margin:0; }
-.normal a:link,
-.normal a:visited { color:#1b75bb; text-decoration:none; }
+#demo-notes a, #demo-link a, #demo-source a { color:#1b75bb; text-decoration:none; }
.normal a:hover,
.normal a:active { color:#0b559b; }
diff --git a/demos/index.html b/demos/index.html
index 22dbfc5c5..b1cfcdd44 100644
--- a/demos/index.html
+++ b/demos/index.html
@@ -20,6 +20,8 @@
<script src="../ui/jquery.ui.draggable.js"></script>
<script src="../ui/jquery.ui.droppable.js"></script>
<script src="../ui/jquery.ui.menu.js"></script>
+ <script src="../ui/jquery.ui.menubar.js"></script>
+ <script src="../ui/jquery.ui.popup.js"></script>
<script src="../ui/jquery.ui.position.js"></script>
<script src="../ui/jquery.ui.progressbar.js"></script>
<script src="../ui/jquery.ui.resizable.js"></script>
@@ -279,6 +281,8 @@
<dd><a href="datepicker/index.html">Datepicker</a></dd>
<dd><a href="dialog/index.html">Dialog</a></dd>
<dd><a href="menu/index.html">Menu</a></dd>
+ <dd><a href="menubar/index.html">Menubar</a></dd>
+ <dd><a href="popup/index.html">Popup</a></dd>
<dd><a href="progressbar/index.html">Progressbar</a></dd>
<dd><a href="slider/index.html">Slider</a></dd>
<dd><a href="spinner/index.html">Spinner</a></dd>
diff --git a/demos/menu/contextmenu.html b/demos/menu/contextmenu.html
index 0fb98c140..115f15b24 100644
--- a/demos/menu/contextmenu.html
+++ b/demos/menu/contextmenu.html
@@ -3,44 +3,28 @@
<head>
<meta charset="UTF-8" />
<title>jQuery UI Menu - Contextmenu demo</title>
- <link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
+ <link href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <link href="../demos.css" rel="stylesheet" />
+ <script>
$(function() {
$(".demo button").button({
icons: {
primary: "ui-icon-home",
secondary: "ui-icon-triangle-1-s"
}
- }).each(function() {
- $(this).next().menu({
- select: function(event, ui) {
- $(this).hide();
- $("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).hide();
- }).click(function(event) {
- var menu = $(this).next();
- if (menu.is(":visible")) {
- menu.hide();
- return false;
+ }).next().menu({
+ select: function(event, ui) {
+ $(this).hide();
+ $("#log").append("<div>Selected " + ui.item.text() + "</div>");
}
- menu.menu("blur").show().position({
- my: "left top",
- at: "right top",
- of: this
- });
- $(document).one("click", function() {
- menu.hide();
- });
- return false;
- })
+ }).popup();
});
</script>
<style>
@@ -69,7 +53,7 @@
<div class="demo-description">
-<p>A simple contextmenu: Click the button, or tab to it and hit space to open the menu. Use the mouse or cursor keys to select an item, click it or hit enter to select it.</p>
+<p>TODO update - A simple contextmenu: Click the button, or tab to it and hit space to open the menu. Use the mouse or cursor keys to select an item, click it or hit enter to select it.</p>
<p>The keyboard handling is part of the menu. Using the input option to menu is configured to add the key event handlers to the button, as that button gets focused when clicked.</p>
diff --git a/demos/menu/default.html b/demos/menu/default.html
index 2d9dddf28..7a1dd99e7 100644
--- a/demos/menu/default.html
+++ b/demos/menu/default.html
@@ -4,12 +4,12 @@
<meta charset="UTF-8" />
<title>jQuery UI Menu - Default demo</title>
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
- <script type="text/javascript" src="../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
- <script type="text/javascript">
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <link href="../demos.css" rel="stylesheet" />
+ <script>
$(function() {
$(".demo ul").menu();
});
diff --git a/demos/menu/index.html b/demos/menu/index.html
index cfc12bc1d..3088f9d7d 100644
--- a/demos/menu/index.html
+++ b/demos/menu/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<title>jQuery UI Menu Demos</title>
- <link type="text/css" href="../demos.css" rel="stylesheet" />
+ <link href="../demos.css" rel="stylesheet" />
</head>
<body>
<div class="demos-nav">
diff --git a/tests/visual/menu/menubar.html b/demos/menubar/default.html
index d2185e97c..be49b4589 100644
--- a/tests/visual/menu/menubar.html
+++ b/demos/menubar/default.html
@@ -1,27 +1,18 @@
<!DOCTYPE html>
<html>
<head>
- <title>Menu Visual Test: Default</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="menubar.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
+ <title>jQuery UI Menubar - Default demo</title>
+ <link rel="stylesheet" href="../demos.css" type="text/css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.menubar.js"></script>
+ <script>
$(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
$("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
$("#bar1, .menubar").menubar({
@@ -40,7 +31,6 @@
});
</script>
<style type="text/css">
- body { font-size:62.5%; }
#bar1, #bar2 { margin: 0 0 4em; } /* style for this page only */
.ui-menu { width: 200px; position: absolute; outline: none; z-index: 9999; }
.ui-menu .ui-icon { float: right; }
@@ -64,7 +54,7 @@
.ui-menubar-item {
float: left;
}
-
+ /*
table {
border-collapse: collapse;
}
@@ -72,10 +62,12 @@
padding: 0.5em;
border: 1px solid black;
}
+ */
</style>
</head>
<body>
+<div class="demo">
<ul id="bar1" class="menubar">
<li>
<a href="#">File</a>
@@ -168,6 +160,7 @@
</li>
</ul>
+<!--
<table id="movies" class="ui-widget">
<thead>
<tr>
@@ -222,11 +215,20 @@
</tr>
</tbody>
</table>
+-->
<div class="ui-widget" style="margin-top:2em; font-family:Arial">
Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
+ <div id="log" style="height: 100px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>
+</div>
+
+<div class="demo-description">
+
+<p>TODO</p>
+
+</div><!-- End demo-description -->
+
</body>
</html>
diff --git a/demos/menubar/index.html b/demos/menubar/index.html
new file mode 100644
index 000000000..3eebda2d0
--- /dev/null
+++ b/demos/menubar/index.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Menubar Demos</title>
+ <link href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+ <div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ </ul>
+ </div>
+</body>
+</html>
diff --git a/demos/popup/default.html b/demos/popup/default.html
new file mode 100644
index 000000000..71b3c8dd2
--- /dev/null
+++ b/demos/popup/default.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Default demo</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ var selected = {
+ select: function( event, ui ) {
+ $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
+ $(this).popup("close");
+ }
+ };
+
+ $("#login-form").popup()
+ .find(":submit").button().click(function(event) {
+ event.preventDefault();
+ });
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+
+ /*
+ table {
+ border-collapse: collapse;
+ }
+ th, td {
+ padding: 0.5em;
+ border: 1px solid black;
+ }
+ */
+
+ #login-form {
+ width: 16em; border: 1px solid gray; border-radius: 5px;
+ padding: 1em;
+ box-shadow: 3px 3px 5px -1px rgba(0, 0, 0, 0.5);
+ background: lightgray; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
+ font-size: 1.3em; outline: none;
+ }
+ #login-form label { display: inline-block; width: 5em; }
+ #login-form .submit { margin-left: 5em; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+ <a href="#login-form">Log In</a>
+ <div id="login-form" class="ui-widget-content" tabIndex="0">
+ <form>
+ <div>
+ <label>Username</label>
+ <input type="username" />
+ </div>
+ <div>
+ <label>Password</label>
+ <input type="password" />
+ </div>
+ <div>
+ <input type="submit" class="submit" value="Login" />
+ </div>
+ </form>
+ </div>
+</div>
+
+<div class="demo-description">
+
+<p>A link to a login form that opens as a popup. [Not quite functional, focus handling needs to get better]</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/popup/index.html b/demos/popup/index.html
new file mode 100644
index 000000000..e69365c98
--- /dev/null
+++ b/demos/popup/index.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>jQuery UI Popup Demos</title>
+ <link href="../demos.css" rel="stylesheet" />
+</head>
+<body>
+ <div class="demos-nav">
+ <h4>Examples</h4>
+ <ul>
+ <li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ <li><a href="popup-menu.html">Menu's as popup</a></li>
+ <li><a href="popup-menu-table.html">Menu's as popup in a table</a></li>
+ </ul>
+ </div>
+</body>
+</html>
diff --git a/demos/popup/popup-menu-table.html b/demos/popup/popup-menu-table.html
new file mode 100644
index 000000000..a06a38434
--- /dev/null
+++ b/demos/popup/popup-menu-table.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Menu as Popup in table demo</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ var selected = {
+ select: function( event, ui ) {
+ $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
+ $(this).popup("close");
+ }
+ };
+
+ $(".demo td:has(.menubar)").clone().appendTo(".demo tbody tr:not(:first)");
+ $("table .menubar > ul").menu(selected).popup().prev().button();
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+
+ .demo table {
+ border-collapse: collapse;
+ }
+ .demo th, .demo td {
+ padding: 0.5em;
+ }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <table id="movies" class="ui-widget">
+ <thead>
+ <tr>
+ <th data-field="Name" class="ui-widget-header">Name</th>
+ <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
+ <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
+ <th class="ui-widget-header"></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
+ <td class="ui-widget-content">1993</td>
+ <td class="ui-widget-content">3.6</td>
+ <td class="ui-widget-content">
+ <div class="menubar">
+ <a href="#">Options</a>
+ <ul>
+ <li><a href="#">Order...</a></li>
+ <li class="ui-state-disabled">Write a Review...</li>
+ <li><a href="#">Find Similar Movies...</a></li>
+ <li>
+ <a href="#">Rate</a>
+ <ul>
+ <li><a href="#">5 stars</a></li>
+ <li><a href="#">4 stars</a></li>
+ <li><a href="#">3 stars</a></li>
+ <li><a href="#">2 stars</a></li>
+ <li><a href="#">1 stars</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.1</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
+ <td class="ui-widget-content">1991</td>
+ <td class="ui-widget-content">3.9</td>
+ </tr>
+ <tr>
+ <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
+ <td class="ui-widget-content">1997</td>
+ <td class="ui-widget-content">2.6</td>
+ </tr>
+ </tbody>
+ </table>
+
+ <div id="log"></div>
+</div>
+
+
+<div class="demo-description">
+
+<p>Poup menu in a table. Works okay standalone, not so much in the scrolling demo view. For that to work better, position() would have to take the closest scrolled parent into account for collision detection.</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/popup/popup-menu.html b/demos/popup/popup-menu.html
new file mode 100644
index 000000000..7152d85bc
--- /dev/null
+++ b/demos/popup/popup-menu.html
@@ -0,0 +1,98 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Popup Menu</title>
+ <link rel="stylesheet" href="../demos.css" />
+ <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
+ <script src="../../jquery-1.5.1.js"></script>
+ <script src="../../ui/jquery.ui.core.js"></script>
+ <script src="../../ui/jquery.ui.widget.js"></script>
+ <script src="../../ui/jquery.ui.position.js"></script>
+ <script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.menu.js"></script>
+ <script src="../../ui/jquery.ui.popup.js"></script>
+ <script>
+ $(function() {
+ function log( msg ) {
+ $( "<div/>" ).text( msg ).appendTo( "#log" );
+ }
+ var selected = {
+ select: function( event, ui ) {
+ log( "Selected: " + ui.item.text() );
+ $(this).popup("close");
+ }
+ };
+
+ $("#button1").button()
+ .next().menu(selected).popup();
+
+ $( "#rerun" )
+ .button()
+ .click(function() {
+ log( "Selected: " + $( this ).text() );
+ })
+ .next()
+ .button({
+ text: false,
+ icons: {
+ primary: "ui-icon-triangle-1-s"
+ }
+ })
+ .next()
+ .menu(selected)
+ .popup({
+ trigger: $("#select")
+ })
+ .parent()
+ .buttonset({
+ items: "button"
+ });
+ });
+ </script>
+ <style type="text/css">
+ .ui-popup { position: absolute; z-index: 5000; }
+ .ui-menu { width: 200px; }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+
+ <button id="button1">Show context menu 1</button>
+ <ul>
+ <li><a href="#">Amsterdam</a></li>
+ <li><a href="#">Anaheim</a></li>
+ <li><a href="#">Cologne</a></li>
+ <li><a href="#">Frankfurt</a></li>
+ <li><a href="#">Magdeburg</a></li>
+ <li><a href="#">Munich</a></li>
+ <li><a href="#">Utrecht</a></li>
+ <li><a href="#">Zurich</a></li>
+ </ul>
+
+
+ <div>
+ <div>
+ <button id="rerun">Run last action</button>
+ <button id="select">Select an action</button>
+ <ul>
+ <li><a href="#">Open...</a></li>
+ <li><a href="#">Save</a></li>
+ <li><a href="#">Delete</a></li>
+ </ul>
+ </div>
+ </div>
+
+ <div id="log"></div>
+</div>
+
+
+<div class="demo-description">
+
+<p>Make the popup a menu (or the menu a popup) and you get context menus.</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
diff --git a/demos/resizable/constrain-area.html b/demos/resizable/constrain-area.html
index a7003352c..33539f940 100644
--- a/demos/resizable/constrain-area.html
+++ b/demos/resizable/constrain-area.html
@@ -10,7 +10,7 @@
<script src="../../ui/jquery.ui.mouse.js"></script>
<script src="../../ui/jquery.ui.resizable.js"></script>
<link rel="stylesheet" href="../demos.css">
- <style\>
+ <style>
#container { width: 300px; height: 300px; }
#container h3 { text-align: center; margin: 0; margin-bottom: 10px; }
#resizable { background-position: top left; width: 150px; height: 150px; }
diff --git a/demos/tooltip/video-player.html b/demos/tooltip/video-player.html
index c890c76b4..56003ab5a 100644
--- a/demos/tooltip/video-player.html
+++ b/demos/tooltip/video-player.html
@@ -10,25 +10,54 @@
<script type="text/javascript" src="../../ui/jquery.ui.tooltip.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="../../tests/visual/menu/popup.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.ui.popup.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.effects.core.js"></script>
+ <script type="text/javascript" src="../../ui/jquery.effects.blind.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
+ function notify( input ) {
+ var msg = "Selected " + $.trim($(input).text());
+ $("<div/>").appendTo(document.body).text(msg).addClass("notification ui-state-default ui-corner-bottom").position({
+ my: "center top",
+ at: "center top",
+ of: window
+ }).show({
+ effect: "blind"
+ }).delay(1000).hide({
+ effect: "blind",
+ duration: "slow"
+ }, function() {
+ $(this).remove();
+ });
+ }
+ $("ul").menu({
+ select: function(event, ui) {
+ // TODO stop button from handling the click
+ $(this).popup("close");
+ // TODO should probably be handled by poup, see ESCAPE key handler
+ // affects key handling
+ $(this).prev().focus();
+ notify(ui.item);
+ }
+ }).popup();
+
$("button").each(function() {
$(this).button({
icons: {
primary: $(this).data("icon")
},
text: !!$(this).attr("title")
+ }).click(function() {
+ // TODO don't notify if the button is opening a popup
+ notify(this);
});
});
- $(".set").buttonset();
-
- // TODO hide the tooltip when clicking the button
- $("ul").menu().popup({
- trigger: $(".menu")
+ $(".set").buttonset({
+ items: "button"
});
+
$(".demo").tooltip({
position: {
my: "center top",
@@ -53,6 +82,10 @@
background: rgba(20, 20, 20, 1);
color: white;
}
+
+ .set { display: inline-block; }
+
+ .notification { position: absolute; display: inline-block; font-size: 2em; padding: .5em; box-shadow: 2px 2px 5px -2px rgba(0,0,0,0.5); }
</style>
</head>
<body>
@@ -65,23 +98,23 @@
<button data-icon="ui-icon-circle-arrow-n" title="I like this">Like</button>
<button data-icon="ui-icon-circle-arrow-s">I dislike this</button>
</span>
- <span class="set">
+ <div class="set">
<button data-icon="ui-icon-circle-plus" title="Add to Watch Later">Add to</button>
<button class="menu" data-icon="ui-icon-triangle-1-s">Add to favorites or playlist</button>
- </span>
+ <ul>
+ <li>
+ <a href="#">Favorites</a>
+ </li>
+ <li>
+ <a href="#">Watch Later</a>
+ </li>
+ <li>
+ <a href="#">New Playlist...</a>
+ </li>
+ </ul>
+ </div>
<button title="Share this video">Share</button>
<button data-icon="ui-icon-alert">Flag as inappropiate</button>
- <ul>
- <li>
- <a href="#">Favorites</a>
- </li>
- <li>
- <a href="#">Watch Later</a>
- </li>
- <li>
- <a href="#">New Playlist...</a>
- </li>
- </ul>
</div>
</div>
diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js
index 35103d89b..eb009064c 100644
--- a/tests/unit/autocomplete/autocomplete_events.js
+++ b/tests/unit/autocomplete/autocomplete_events.js
@@ -203,4 +203,20 @@ test("cancel select", function() {
}, 50);
});
+test("blur without selection", function() {
+ expect(1);
+ var ac = $("#autocomplete").autocomplete({
+ delay: 0,
+ source: data
+ });
+ stop();
+ ac.val("j").keydown();
+ setTimeout(function() {
+ $( ".ui-menu-item" ).first().simulate("mouseover");
+ ac.simulate("keydown", { keyCode: $.ui.keyCode.TAB });
+ same( ac.val(), "j" );
+ start();
+ }, 50);
+});
+
})(jQuery);
diff --git a/tests/unit/datepicker/datepicker.html b/tests/unit/datepicker/datepicker.html
index 76082e780..fa346c6c9 100644
--- a/tests/unit/datepicker/datepicker.html
+++ b/tests/unit/datepicker/datepicker.html
@@ -12,6 +12,7 @@
<script type="text/javascript" src="../../../ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-fr.js"></script>
<script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-he.js"></script>
+ <script type="text/javascript" src="../../../ui/i18n/jquery.ui.datepicker-zh-CN.js"></script>
<link rel="stylesheet" href="../../../external/qunit.css" type="text/css"/>
<script type="text/javascript" src="../../../external/qunit.js"></script>
diff --git a/tests/unit/datepicker/datepicker_core.js b/tests/unit/datepicker/datepicker_core.js
index 78f78ce38..badb837ed 100644
--- a/tests/unit/datepicker/datepicker_core.js
+++ b/tests/unit/datepicker/datepicker_core.js
@@ -116,8 +116,16 @@ test('baseStructure', function() {
ok(child.is('div.ui-datepicker-group') && child.is('div.ui-datepicker-group-last'), 'Structure multi [2] - second month division');
child = dp.children(':eq(2)');
ok(child.is('div.ui-datepicker-row-break'), 'Structure multi [2] - row break');
+ ok(dp.is('.ui-datepicker-multi-2'), 'Structure multi [2] - multi-2');
inp.datepicker('hide').datepicker('destroy');
+ // Multi-month 3
+ inp = init('#inp', {numberOfMonths: 3});
+ inp.focus();
+ ok(dp.is('.ui-datepicker-multi-3'), 'Structure multi [3] - multi-3');
+ ok(! dp.is('.ui-datepicker-multi-2'), 'Structure multi [3] - Trac #6704');
+ inp.datepicker('hide').datepicker('destroy');
+
// Multi-month [2, 2]
inp = init('#inp', {numberOfMonths: [2, 2]});
inp.focus();
diff --git a/tests/unit/datepicker/datepicker_options.js b/tests/unit/datepicker/datepicker_options.js
index 4f1e9a164..a10d1ea45 100644
--- a/tests/unit/datepicker/datepicker_options.js
+++ b/tests/unit/datepicker/datepicker_options.js
@@ -827,6 +827,10 @@ test('parseDate', function() {
equalsDate($.datepicker.parseDate('\'jour\' d \'de\' MM (\'\'DD\'\'), yy',
'jour 9 de Avril (\'Lundi\'), 2001', settings), new Date(2001, 4 - 1, 9),
'Parse date \'jour\' d \'de\' MM (\'\'DD\'\'), yy with settings');
+
+ var zh = $.datepicker.regional['zh-CN'];
+ equalsDate($.datepicker.parseDate('yy M d', '2011 十一 22', zh),
+ new Date(2011, 11 - 1, 22), 'Parse date yy M d with zh-CN');
});
test('parseDateErrors', function() {
diff --git a/tests/unit/tabs/spinner.gif b/tests/unit/tabs/spinner.gif
deleted file mode 100644
index 822747576..000000000
--- a/tests/unit/tabs/spinner.gif
+++ /dev/null
Binary files differ
diff --git a/tests/unit/tabs/tabs.html b/tests/unit/tabs/tabs.html
index 565a0b427..34ec28bc4 100644
--- a/tests/unit/tabs/tabs.html
+++ b/tests/unit/tabs/tabs.html
@@ -24,7 +24,6 @@
<script src="tabs_events.js"></script>
<script src="tabs_methods.js"></script>
<script src="tabs_options.js"></script>
- <script src="tabs_tickets.js"></script>
<script>
function tabs_state( tabs ) {
diff --git a/tests/unit/tabs/tabs_core.js b/tests/unit/tabs/tabs_core.js
index c9b16e3a8..98cb617ec 100644
--- a/tests/unit/tabs/tabs_core.js
+++ b/tests/unit/tabs/tabs_core.js
@@ -63,4 +63,32 @@ test( "accessibility", function() {
// TODO: add tests
});
+test( "#3627 - Ajax tab with url containing a fragment identifier fails to load", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs({
+ active: 2,
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( /test.html$/.test( ui.ajaxSettings.url ), "should ignore fragment identifier" );
+ }
+ });
+});
+
+test( "#4033 - IE expands hash to full url and misinterprets tab as ajax", function() {
+ expect( 2 );
+
+ var element = $( "<div><ul><li><a href='#tab'>Tab</a></li></ul><div id='tab'></div></div>" );
+ element.appendTo( "#main" );
+ element.tabs({
+ beforeLoad: function( event, ui ) {
+ event.preventDefault();
+ ok( false, 'should not be an ajax tab');
+ }
+ });
+
+ equals( element.find( ".ui-tabs-nav a" ).attr( "aria-controls" ), "tab", "aria-contorls attribute is correct" );
+ tabs_state( element, 1 );
+});
+
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_deprecated.html b/tests/unit/tabs/tabs_deprecated.html
index e71fea3d4..89d08f4d0 100644
--- a/tests/unit/tabs/tabs_deprecated.html
+++ b/tests/unit/tabs/tabs_deprecated.html
@@ -22,7 +22,6 @@
<script src="tabs_events.js"></script>
<script src="tabs_methods.js"></script>
<script src="tabs_options.js"></script>
- <script src="tabs_tickets.js"></script>
<script src="tabs_deprecated.js"></script>
<script>
diff --git a/tests/unit/tabs/tabs_deprecated.js b/tests/unit/tabs/tabs_deprecated.js
index 90c43037c..4b50df405 100644
--- a/tests/unit/tabs/tabs_deprecated.js
+++ b/tests/unit/tabs/tabs_deprecated.js
@@ -1,6 +1,6 @@
(function( $ ) {
-module("tabs (deprecated): core");
+module( "tabs (deprecated): core" );
test( "panel ids", function() {
expect( 2 );
@@ -20,91 +20,149 @@ test( "panel ids", function() {
element.tabs( "option", "active", 2 );
});
-module("tabs (deprecated): options");
+module( "tabs (deprecated): options" );
-test('ajaxOptions', function() {
- ok(false, "missing test - untested code is broken code.");
-});
+asyncTest( "ajaxOptions", function() {
+ expect( 1 );
-test('cache', function() {
- ok(false, "missing test - untested code is broken code.");
+ var element = $( "#tabs2" ).tabs({
+ ajaxOptions: {
+ converters: {
+ "text html": function() {
+ return "test";
+ }
+ }
+ }
+ });
+ element.one( "tabsload", function( event, ui ) {
+ equals( ui.panel.html(), "test" );
+ start();
+ });
+ element.tabs( "option", "active", 2 );
});
-test('idPrefix', function() {
- ok(false, "missing test - untested code is broken code.");
-});
+asyncTest( "cache", function() {
+ expect( 5 );
-test('tabTemplate', function() {
- ok(false, "missing test - untested code is broken code.");
+ var element = $( "#tabs2" ).tabs({
+ cache: true
+ });
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( true, "tabsload" );
+
+ setTimeout(function() {
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0, 0, 0 );
+
+ element.one( "tabsshow", function( event, ui ) {
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ ok( false, "should be cached" );
+ });
+ element.tabs( "option", "active", 2 );
+ start();
+ }, 1 );
+ });
+ element.tabs( "option", "active", 2 );
+ tabs_state( element, 0, 0, 1, 0, 0 );
});
-test('panelTemplate', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "idPrefix", function() {
+ expect( 1 );
+
+ $( "#tabs2" )
+ .one( "tabsbeforeload", function( event, ui ) {
+ ok( /^testing-\d+$/.test( ui.panel.attr( "id" ) ), "generated id" );
+ event.preventDefault();
+ })
+ .tabs({
+ idPrefix: "testing-",
+ active: 2
+ });
});
-test('cookie', function() {
- expect(6);
+test( "tabTemplate + panelTemplate", function() {
+ // defaults are tested in the add method test
+ expect( 11 );
+
+ var element = $( "#tabs2" ).tabs({
+ tabTemplate: "<li class='customTab'><a href='http://example.com/#{href}'>#{label}</a></li>",
+ panelTemplate: "<div class='customPanel'></div>"
+ });
+ element.one( "tabsadd", function( event, ui ) {
+ var anchor = $( ui.tab );
+ equal( ui.index, 5, "ui.index" );
+ equal( anchor.text(), "New", "ui.tab" );
+ equal( anchor.attr( "href" ), "http://example.com/#new", "tab href" );
+ ok( anchor.parent().hasClass( "customTab" ), "tab custom class" );
+ equal( ui.panel.id, "new", "ui.panel" );
+ ok( $( ui.panel ).hasClass( "customPanel" ), "panel custom class" );
+ });
+ element.tabs( "add", "#new", "New" );
+ var tab = element.find( ".ui-tabs-nav li" ).last(),
+ anchor = tab.find( "a" );
+ equals( tab.text(), "New", "label" );
+ ok( tab.hasClass( "customTab" ), "tab custom class" );
+ equals( anchor.attr( "href" ), "http://example.com/#new", "href" );
+ equals( anchor.attr( "aria-controls" ), "new", "aria-controls" );
+ ok( element.find( "#new" ).hasClass( "customPanel" ), "panel custom class" );
+});
- el = $('#tabs1');
- var cookieName = 'tabs_test', cookieObj = { name: cookieName };
- $.cookie(cookieName, null); // blank state
- var cookie = function() {
- return parseInt($.cookie(cookieName), 10);
- };
+test( "cookie", function() {
+ expect( 6 );
- el.tabs({ cookie: cookieObj });
- equals(cookie(), 0, 'initial cookie value');
+ var element = $( "#tabs1" ),
+ cookieName = "tabs_test",
+ cookieObj = { name: cookieName };
+ $.cookie( cookieName, null );
+ function cookie() {
+ return parseInt( $.cookie( cookieName ), 10 );
+ }
- el.tabs('destroy');
- el.tabs({ active: 1, cookie: cookieObj });
- equals(cookie(), 1, 'initial cookie value, from active property');
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 0, "initial cookie value" );
- el.tabs('option', 'active', 2);
- equals(cookie(), 2, 'cookie value updated after activating');
+ element.tabs( "destroy" );
+ element.tabs({ active: 1, cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from active property" );
- el.tabs('destroy');
- $.cookie(cookieName, 1);
- el.tabs({ cookie: cookieObj });
- equals(cookie(), 1, 'initial cookie value, from existing cookie');
+ element.tabs( "option", "active", 2 );
+ equals( cookie(), 2, "cookie value updated after activating" );
- el.tabs('destroy');
- el.tabs({ cookie: cookieObj, collapsible: true });
- el.tabs('option', 'active', false);
- equals(cookie(), -1, 'cookie value for all tabs unselected');
+ element.tabs( "destroy" );
+ $.cookie( cookieName, 1 );
+ element.tabs({ cookie: cookieObj });
+ equals( cookie(), 1, "initial cookie value, from existing cookie" );
- el.tabs('destroy');
- ok($.cookie(cookieName) === null, 'erase cookie after destroy');
+ element.tabs( "destroy" );
+ element.tabs({ cookie: cookieObj, collapsible: true });
+ element.tabs( "option", "active", false );
+ equals( cookie(), -1, "cookie value for all tabs unselected" );
+ element.tabs( "destroy" );
+ ok( $.cookie( cookieName ) === null, "erase cookie after destroy" );
});
+asyncTest( "spinner", function() {
+ expect( 2 );
-test('spinner', function() {
- expect(4);
- stop();
-
- el = $('#tabs2');
-
- el.tabs({
- selected: 2,
- load: function() {
- // spinner: default spinner
- setTimeout(function() {
- equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
- equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
- el.tabs('destroy');
- el.tabs({
- selected: 2,
- spinner: '<img src="spinner.gif" alt="">',
- load: function() {
- // spinner: image
- equals($('li:eq(2) > a > span', el).length, 1, "should restore tab markup after spinner is removed");
- equals($('li:eq(2) > a > span', el).html(), '3', "should restore tab label after spinner is removed");
- start();
- }
- });
- }, 1);
- }
+ var element = $( "#tabs2" ).tabs();
+
+ element.one( "tabsbeforeload", function( event, ui ) {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 1, "beforeload" );
+ });
+ element.one( "tabsload", function( event, ui ) {
+ // wait until after the load finishes before checking for the spinner to be removed
+ setTimeout(function() {
+ equals( element.find( ".ui-tabs-nav li:eq(2) em" ).length, 0, "load" );
+ start();
+ }, 1 );
});
+ element.tabs( "option", "active", 2 );
});
test( "selected", function() {
@@ -193,45 +251,85 @@ test( "disable", function() {
element.tabs( "disable", 1 );
});
-test('show', function() {
- expect(5);
- var uiObj, eventObj;
- el = $('#tabs1').tabs({
- show: function(event, ui) {
- uiObj = ui;
- eventObj = event;
- }
+test( "show", function() {
+ expect( 13 );
+
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsshow", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
});
- ok(uiObj !== undefined, 'trigger callback after initialization');
- equals(uiObj.tab, $('a', el)[0], 'contain tab as DOM anchor element');
- equals(uiObj.panel, $('div', el)[0], 'contain panel as DOM div element');
- equals(uiObj.index, 0, 'contain index');
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
- el.find( "li:eq(1) a" ).simulate( "click" );
- equals( eventObj.originalEvent.type, "click", "show triggered by click" );
+ // switching tabs
+ element.one( "tabsshow", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 0, 1, 0 );
+ });
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
+ // collapsing
+ element.one( "tabsshow", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
});
-test('select', function() {
- expect(7);
+test( "select", function() {
+ expect( 13 );
- var eventObj;
- el = $('#tabs1').tabs({
- select: function(event, ui) {
- ok(true, 'select triggered after initialization');
- equals(this, el[0], "context of callback");
- equals(event.type, 'tabsselect', 'event type in callback');
- equals(ui.tab, el.find('a')[1], 'contain tab as DOM anchor element');
- equals(ui.panel, el.find('div')[1], 'contain panel as DOM div element');
- equals(ui.index, 1, 'contain index');
- evenObj = event;
- }
+ var element = $( "#tabs1" ).tabs({
+ active: false,
+ collapsible: true
+ }),
+ tabs = element.find( ".ui-tabs-nav a" ),
+ panels = element.find( ".ui-tabs-panel" );
+
+ // from collapsed
+ element.one( "tabsselect", function( event, ui ) {
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ strictEqual( ui.tab, tabs[ 0 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 0 ], "ui.panel" );
+ equal( ui.index, 0, "ui.index" );
+ tabs_state( element, 0, 0, 0 );
+ });
+ element.tabs( "option", "active", 0 );
+ tabs_state( element, 1, 0, 0 );
+
+ // switching tabs
+ element.one( "tabsselect", function( event, ui ) {
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ strictEqual( ui.tab, tabs[ 1 ], "ui.tab" );
+ strictEqual( ui.panel, panels[ 1 ], "ui.panel" );
+ equal( ui.index, 1, "ui.index" );
+ tabs_state( element, 1, 0, 0 );
});
- el.tabs('select', 1);
+ tabs.eq( 1 ).click();
+ tabs_state( element, 0, 1, 0 );
- el.find( "li:eq(1) a" ).simulate( "click" );
- equals( evenObj.originalEvent.type, "click", "select triggered by click" );
+ // collapsing
+ element.one( "tabsselect", function( event, ui ) {
+ ok( false, "collapsing" );
+ });
+ element.tabs( "option", "active", false );
+ tabs_state( element, 0, 0, 0 );
});
module( "tabs (deprecated): methods" );
@@ -405,4 +503,18 @@ test( "url", function() {
element.tabs( "option", "active", 3 );
});
+asyncTest( "abort", function() {
+ expect( 1 );
+
+ var element = $( "#tabs2" ).tabs();
+ element.one( "tabsbeforeload", function( event, ui ) {
+ ui.jqXHR.error(function( jqXHR, status ) {
+ equals( status, "abort", "aborted" );
+ start();
+ });
+ });
+ element.tabs( "option", "active", 2 );
+ element.tabs( "abort" );
+});
+
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_events.js b/tests/unit/tabs/tabs_events.js
index 28925a2b9..2fabaafca 100644
--- a/tests/unit/tabs/tabs_events.js
+++ b/tests/unit/tabs/tabs_events.js
@@ -138,15 +138,32 @@ test( "activate", function() {
});
test( "beforeLoad", function() {
- expect( 21 );
+ expect( 32 );
var tab, panelId, panel,
- element = $( "#tabs2" ).tabs();
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsbeforeload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
- // TODO: init
-// element.one( "tabsbeforeload", function( event, ui ) {
-// });
-// element.tabs({ active: 2 });
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ ok( "abort" in ui.jqXHR, "jqXHR" );
+ ok( ui.ajaxSettings.url, "data/test.html", "ajaxSettings.url" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.html(), "", "panel html" );
+ event.preventDefault();
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ });
+ element.tabs({ active: 2 });
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ equals( panel.html(), "", "panel html after" );
+ element.tabs( "destroy" );
// .option()
element.one( "tabsbeforeload", function( event, ui ) {
@@ -165,6 +182,7 @@ test( "beforeLoad", function() {
event.preventDefault();
tabs_state( element, 1, 0, 0, 0, 0 );
});
+ element.tabs();
element.tabs( "option", "active", 2 );
tabs_state( element, 0, 0, 1, 0, 0 );
equals( panel.html(), "", "panel html after" );
@@ -191,8 +209,66 @@ test( "beforeLoad", function() {
equals( panel.html(), "<p>testing</p>", "panel html after" );
});
-test( "load", function() {
- ok( false, "missing test - untested code is broken code." );
+asyncTest( "load", function() {
+ expect( 21 );
+
+ var tab, panelId, panel,
+ element = $( "#tabs2" );
+
+ // init
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 2 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 1, 0, 0 );
+ tabsload1();
+ });
+ element.tabs({ active: 2 });
+
+ function tabsload1() {
+ // .option()
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 3 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ ok( !( "originalEvent" in event ), "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 1, 0 );
+ tabsload2();
+ });
+ element.tabs( "option", "active", 3 );
+ }
+
+ function tabsload2() {
+ // click, change panel content
+ element.one( "tabsload", function( event, ui ) {
+ tab = element.find( ".ui-tabs-nav a" ).eq( 4 );
+ panelId = tab.attr( "aria-controls" );
+ panel = $( "#" + panelId );
+
+ equals( event.originalEvent.type, "click", "originalEvent" );
+ equals( ui.tab.size(), 1, "tab size" );
+ strictEqual( ui.tab[ 0 ], tab[ 0 ], "tab" );
+ equals( ui.panel.size(), 1, "panel size" );
+ strictEqual( ui.panel[ 0 ], panel[ 0 ], "panel" );
+ equals( ui.panel.find( "p" ).length, 1, "panel html" );
+ tabs_state( element, 0, 0, 0, 0, 1 );
+ start();
+ });
+ element.find( ".ui-tabs-nav a" ).eq( 4 ).click();
+ }
});
}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_methods.js b/tests/unit/tabs/tabs_methods.js
index a6e60a4b3..221b0d39d 100644
--- a/tests/unit/tabs/tabs_methods.js
+++ b/tests/unit/tabs/tabs_methods.js
@@ -2,19 +2,10 @@
module( "tabs: methods" );
-test('destroy', function() {
- expect(6);
-
- el = $('#tabs1').tabs({ collapsible: true });
- $('li:eq(2)', el).simulate('mouseover').find('a').focus();
- el.tabs('destroy');
-
- ok( el.is(':not(.ui-tabs, .ui-widget, .ui-widget-content, .ui-corner-all, .ui-tabs-collapsible)'), 'remove classes from container');
- ok( $('ul', el).is(':not(.ui-tabs-nav, .ui-helper-reset, .ui-helper-clearfix, .ui-widget-header, .ui-corner-all)'), 'remove classes from list' );
- ok( $('div:eq(1)', el).is(':not(.ui-tabs-panel, .ui-widget-content, .ui-corner-bottom)'), 'remove classes to panel' );
- ok( $('li:eq(0)', el).is(':not(.ui-tabs-active, .ui-state-active, .ui-corner-top)'), 'remove classes from active li');
- ok( $('li:eq(1)', el).is(':not(.ui-state-default, .ui-corner-top)'), 'remove classes from inactive li');
- ok( $('li:eq(2)', el).is(':not(.ui-state-hover, .ui-state-focus)'), 'remove classes from mouseovered or focused li');
+test( "destroy", function() {
+ domEqual( "#tabs1", function() {
+ $( "#tabs1" ).tabs().tabs( "destroy" );
+ });
});
test( "enable", function() {
diff --git a/tests/unit/tabs/tabs_options.js b/tests/unit/tabs/tabs_options.js
index 691186276..8d61c47ef 100644
--- a/tests/unit/tabs/tabs_options.js
+++ b/tests/unit/tabs/tabs_options.js
@@ -133,28 +133,81 @@ test( "{ collapsible: true }", function() {
tabs_state( element, 0, 0, 0 );
});
-test('disabled', function() {
- expect(4);
+test( "disabled", function() {
+ expect( 10 );
- el = $('#tabs1').tabs();
- same(el.tabs('option', 'disabled'), false, "should not disable any tab by default");
+ // fully enabled by default
+ var element = $( "#tabs1" ).tabs();
+ tabs_disabled( element, false );
+
+ // disable single tab
+ element.tabs( "option", "disabled", [ 1 ] );
+ tabs_disabled( element, [ 1 ] );
- el.tabs('option', 'disabled', [ 1 ]);
- same(el.tabs('option', 'disabled'), [ 1 ], "should set property"); // everything else is being tested in methods module...
+ // disabled active tab
+ element.tabs( "option", "disabled", [ 0, 1 ] );
+ tabs_disabled( element, [ 0, 1 ] );
- el.tabs('option', 'disabled', [ 0, 1 ]);
- same(el.tabs('option', 'disabled'), [ 0, 1 ], "should disable given tabs, even selected one"); // ...
+ // disable all tabs
+ element.tabs( "option", "disabled", [ 0, 1, 2 ] );
+ tabs_disabled( element, true );
- el.tabs('option', 'disabled', [ ]);
- same(el.tabs('option', 'disabled'), false, "should not disable any tab"); // ...
+ // enable all tabs
+ element.tabs( "option", "disabled", [] );
+ tabs_disabled( element, false );
});
-test('event', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "{ event: null }", function() {
+ expect( 5 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: null
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.tabs( "option", "active", 1 );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).click();
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
});
-test('fx', function() {
- ok(false, "missing test - untested code is broken code.");
+test( "{ event: custom }", function() {
+ expect( 11 );
+
+ var element = $( "#tabs1" ).tabs({
+ event: "custom1 custom2"
+ });
+ tabs_state( element, 1, 0, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ // ensure default click handler isn't bound
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "click" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 2 ).trigger( "custom2" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.tabs( "option", "event", "custom3" );
+
+ // ensure old event handlers are unbound
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom1" );
+ equal( element.tabs( "option", "active" ), 2 );
+ tabs_state( element, 0, 0, 1 );
+
+ element.find( ".ui-tabs-nav a" ).eq( 1 ).trigger( "custom3" );
+ equal( element.tabs( "option", "active" ), 1 );
+ tabs_state( element, 0, 1, 0 );
});
-})(jQuery);
+// TODO: add animation tests
+
+}( jQuery ) );
diff --git a/tests/unit/tabs/tabs_tickets.js b/tests/unit/tabs/tabs_tickets.js
deleted file mode 100644
index d7a59cb5b..000000000
--- a/tests/unit/tabs/tabs_tickets.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * tabs_tickets.js
- */
-(function($) {
-
-module("tabs: tickets");
-
-test('#3627 - Ajax tab with url containing a fragment identifier fails to load', function() {
- // http://dev.jqueryui.com/ticket/3627
- expect(1);
-
- el = $('#tabs2').tabs({
- active: 2,
- beforeLoad: function( event, ui ) {
- event.preventDefault();
- ok(/test.html$/.test( ui.ajaxSettings.url ), 'should ignore fragment identifier');
- }
- });
-});
-
-test('#4033 - IE expands hash to full url and misinterprets tab as ajax', function() {
- // http://dev.jqueryui.com/ticket/4033
- expect(1);
-
- el = $('<div><ul><li><a href="#tab">Tab</a></li></ul><div id="tab"></div></div>');
- el.appendTo('#main');
- el.tabs({
- beforeLoad: function( event, ui ) {
- event.preventDefault();
- ok( false, 'should not be an ajax tab');
- }
- });
-
- equals($('a', el).attr('aria-controls'), 'tab', 'aria-contorls attribute is correct');
-});
-
-})(jQuery);
diff --git a/tests/visual/effects.all.html b/tests/visual/effects.all.html
index 1fc35f700..fed35de8a 100644
--- a/tests/visual/effects.all.html
+++ b/tests/visual/effects.all.html
@@ -146,6 +146,18 @@
</li>
<li>
+ <div class="effect" id="size">
+ <p>Size Default Show/Hide</p>
+ </div>
+ </li>
+
+ <li>
+ <div class="effect" id="sizeToggle">
+ <p>Size Toggle</p>
+ </div>
+ </li>
+
+ <li>
<div class="effect" id="slideDown">
<p>Slide down</p>
</div>
diff --git a/tests/visual/effects.all.js b/tests/visual/effects.all.js
index 9cf7487c9..a28c41a89 100644
--- a/tests/visual/effects.all.js
+++ b/tests/visual/effects.all.js
@@ -30,10 +30,10 @@ $(function() {
var el = $(this);
el.addClass("current").hide(duration, function() {
setTimeout(function() {
- el.show(duration, function() { el.removeClass("current") });
+ el.show(duration, function() { el.removeClass("current"); });
}, wait);
- })
- })
+ });
+ });
effect("#blindLeft", "blind", { direction: "left" });
effect("#blindUp", "blind", { direction: "up" });
@@ -63,6 +63,16 @@ $(function() {
effect("#puff", "puff", { times: 2 });
effect("#scale", "scale", {});
+ effect("#size", "size", {});
+ $("#sizeToggle").bind("click", function() {
+ var opts = { to: { width: 300, height: 300 }};
+ $(this).addClass('current')
+ .toggle("size", opts, duration)
+ .delay(wait)
+ .toggle("size", opts, duration, function() {
+ $(this).removeClass("current");
+ });
+ });
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
@@ -84,13 +94,13 @@ $(function() {
$("#removeClass").click(function() {
$(this).addClass("current").removeClass(function() {
window.console && console.log(arguments);
- return "current"
+ return "current";
}, duration);
});
$("#toggleClass").click(function() {
$(this).toggleClass(function() {
window.console && console.log(arguments);
- return "current"
+ return "current";
}, duration);
});
});
diff --git a/tests/visual/menu/contextmenu.html b/tests/visual/menu/contextmenu.html
deleted file mode 100644
index 63d9877a0..000000000
--- a/tests/visual/menu/contextmenu.html
+++ /dev/null
@@ -1,191 +0,0 @@
-<!doctype html>
-<html>
-<head>
- <title>Menu Visual Test: Default</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
- $(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
- // TODO close other menus when opening a new one
- $("button").each(function() {
- $(this).next().menu({
- /* top-alignment
- position: function(item) {
- return {
- my: "left top",
- at: "right top",
- of: item.parent()
- }
- },
- */
- select: function(event, ui) {
- $(this).hide().prev().focus();
- $("#log").append("<div>Selected " + ui.item.text() + "</div>");
- }
- }).hide();
-
- // equal height
- //menu.find("ul").height(menu.height());
- }).click(function(event) {
- // required to prevent the click handler below from handling this event
- event.stopPropagation();
- var menu = $("#menu" + this.id).menu("blur").show().position({
- my: "left top",
- at: "right top",
- of: event.pageX > 0 ? event : this
- }).focus();
- $(document).one("click", function() {
- menu.menu("closeAll").menu("widget").hide();
- })
- }).next().keydown(function(event) {
- var menu = $(this).data("menu");
- if (menu.widget().is(":hidden"))
- return;
- event.stopPropagation();
- switch (event.keyCode) {
- case $.ui.keyCode.TAB:
- menu.closeAll();
- menu.widget().hide();
- $(this).prev().focus()
- break;
- case $.ui.keyCode.ESCAPE:
- menu.closeAll();
- menu.widget().hide();
- $(this).prev().focus()
- break;
- default:
-
- }
- });
- });
- </script>
- <style>
- body { font-size:62.5%; }
- .ui-menu { width: 200px; position: absolute; }
- #menu3 { height: 200px; overflow: auto; }
- </style>
-</head>
-<body>
-
-<button id="1">Show context menu 1</button>
-<ul id="menu1">
- <li><a href="#">Amsterdam</a></li>
- <li><a href="#">Anaheim</a></li>
- <li><a href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li><a href="#">Magdeburg</a></li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-<button id="2">Show context menu 2</button>
-<ul id="menu2">
- <li>
- <a id="a1" href="#">Amsterdam</a>
- <ul>
- <li><a id="b1" href="#">Aberdeen</a></li>
- <li><a id="b2" href="#">Ada</a></li>
- <li>
- <a href="#">Adamsville</a>
- <ul>
- <li><a href="#">Anaheim</a></li>
- <li>
- <a href="#">Cologne</a>
- <ul>
- <li><a href="#">Mberdeen</a></li>
- <li><a href="#">Mda</a></li>
- <li><a href="#">Mdamsville</a></li>
- <li><a href="#">Mddyston</a></li>
- <li><a href="#">Mmesville</a></li>
- </ul>
- </li>
- <li><a href="#">Frankfurt</a></li>
- </ul>
- </li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Amesville</a></li>
- </ul>
- </li>
- <li><a id="a2" href="#">Anaheim</a></li>
- <li><a id="a3" href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li>
- <a href="#">Magdeburg</a>
- <ul>
- <li><a href="#">Mberdeen</a></li>
- <li><a href="#">Mda</a></li>
- <li><a href="#">Mdamsville</a></li>
- <li><a href="#">Mddyston</a></li>
- <li><a href="#">Mmesville</a></li>
- </ul>
- </li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-<button id="3">Show context menu 3</button>
-<ul id="menu3">
- <li><a href="#">Aberdeen</a></li>
- <li><a href="#">Ada</a></li>
- <li><a href="#">Adamsville</a></li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Adelphi</a></li>
- <li><a href="#">Adena</a></li>
- <li><a href="#">Adrian</a></li>
- <li><a href="#">Akron</a></li>
- <li><a href="#">Albany</a></li>
- <li><a href="#">Alexandria</a></li>
- <li><a href="#">Alger</a></li>
- <li><a href="#">Alledonia</a></li>
- <li><a href="#">Alliance</a></li>
- <li><a href="#">Alpha</a></li>
- <li><a href="#">Alvada</a></li>
- <li><a href="#">Alvordton</a></li>
- <li><a href="#">Amanda</a></li>
- <li><a href="#">Amelia</a></li>
- <li><a href="#">Amesville</a></li>
- <li><a href="#">Aberdeen</a></li>
- <li><a href="#">Ada</a></li>
- <li><a href="#">Adamsville</a></li>
- <li><a href="#">Addyston</a></li>
- <li><a href="#">Adelphi</a></li>
- <li><a href="#">Adena</a></li>
- <li><a href="#">Adrian</a></li>
- <li><a href="#">Akron</a></li>
- <li><a href="#">Albany</a></li>
- <li><a href="#">Alexandria</a></li>
- <li><a href="#">Alger</a></li>
- <li><a href="#">Alledonia</a></li>
- <li><a href="#">Alliance</a></li>
- <li><a href="#">Alpha</a></li>
- <li><a href="#">Alvada</a></li>
- <li><a href="#">Alvordton</a></li>
- <li><a href="#">Amanda</a></li>
- <li><a href="#">Amelia</a></li>
- <li><a href="#">Amesville</a></li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js
deleted file mode 100644
index cc3258d4a..000000000
--- a/tests/visual/menu/menubar.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * jQuery UI menubar
- *
- * backported from Michael Lang's fork: http://www.nexul.com/prototypes/toolbar/demo.html
- */
-(function($) {
-
-// TODO take non-menubar buttons into account
-$.widget("ui.menubar", {
- options: {
- buttons: false,
- menuIcon: false
- },
- _create: function() {
- var self = this;
- var items = this.items = this.element.children("li")
- .addClass("ui-menubar-item")
- .attr("role", "presentation")
- .children("button, a");
- items.slice(1).attr("tabIndex", -1);
- var o = this.options;
-
- this.element.addClass('ui-menubar ui-widget-header ui-helper-clearfix').attr("role", "menubar");
- this._focusable(items);
- this._hoverable(items);
- items.next("ul").each(function(i, elm) {
- $(elm).menu({
- select: function(event, ui) {
- ui.item.parents("ul.ui-menu:last").hide();
- self._trigger( "select", event, ui );
- self._close();
- $(event.target).prev().focus();
- }
- }).hide()
- .attr("aria-hidden", "true")
- .attr("aria-expanded", "false")
- .keydown(function(event) {
- var menu = $(this);
- if (menu.is(":hidden"))
- return;
- switch (event.keyCode) {
- case $.ui.keyCode.LEFT:
- self._left(event);
- event.preventDefault();
- break;
- case $.ui.keyCode.RIGHT:
- self._right(event);
- event.preventDefault();
- break;
- };
- })
- });
- items.each(function() {
- var input = $(this),
- menu = input.next("ul");
-
- input.bind("click focus mouseenter", function(event) {
- // ignore triggered focus event
- if (event.type == "focus" && !event.originalEvent) {
- return;
- }
- event.preventDefault();
- if (event.type == "click" && menu.is(":visible") && self.active && self.active[0] == menu[0]) {
- self._close();
- return;
- }
- if ((self.open && event.type == "mouseenter") || event.type == "click") {
- self._open(event, menu);
- }
- })
- .bind( "keydown", function( event ) {
- switch ( event.keyCode ) {
- case $.ui.keyCode.SPACE:
- case $.ui.keyCode.UP:
- case $.ui.keyCode.DOWN:
- self._open( event, $( this ).next() );
- event.preventDefault();
- break;
- case $.ui.keyCode.LEFT:
- self._prev( event, $( this ) );
- event.preventDefault();
- break;
- case $.ui.keyCode.RIGHT:
- self._next( event, $( this ) );
- event.preventDefault();
- break;
- }
- })
- .addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
- .attr("role", "menuitem")
- .attr("aria-haspopup", "true")
- .wrapInner("<span class='ui-button-text'></span>");
-
- if (o.menuIcon) {
- input.addClass("ui-state-default").append("<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>");
- input.removeClass("ui-button-text-only").addClass("ui-button-text-icon-secondary");
- }
-
- if (!o.buttons) {
- input.addClass('ui-menubar-link').removeClass('ui-state-default');
- };
-
- });
- self._bind({
- keydown: function(event) {
- if (event.keyCode == $.ui.keyCode.ESCAPE) {
- if (self.active && self.active.menu("left", event) !== true) {
- var active = self.active;
- self.active.blur();
- self._close( event );
- active.prev().focus();
- }
- }
- },
- focusout : function( event ) {
- self.closeTimer = setTimeout(function() {
- self._close( event );
- }, 100);
- },
- focusin :function( event ) {
- clearTimeout(self.closeTimer);
- }
- });
- },
-
- _destroy : function() {
- var items = this.element.children("li")
- .removeClass("ui-menubar-item")
- .removeAttr("role", "presentation")
- .children("button, a");
-
- this.element.removeClass('ui-menubar ui-widget-header ui-helper-clearfix').removeAttr("role", "menubar").unbind(".menubar");;
- items.unbind("focusin focusout click focus mouseenter keydown");
-
- items
- .removeClass("ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default")
- .removeAttr("role", "menuitem")
- .removeAttr("aria-haspopup", "true")
- .children("span.ui-button-text").each(function(i, e) {
- var item = $(this);
- item.parent().html(item.html());
- })
- .end()
- .children(".ui-icon").remove();
-
- $(document).unbind(".menubar");
-
- this.element.find(":ui-menu").menu("destroy")
- .show()
- .removeAttr("aria-hidden", "true")
- .removeAttr("aria-expanded", "false")
- .removeAttr("tabindex")
- .unbind("keydown", "blur")
- ;
- },
-
- _close: function() {
- if (!this.active || !this.active.length)
- return;
- this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
- this.active.prev().removeClass("ui-state-active").removeAttr("tabIndex");
- this.active = null;
- this.open = false;
- },
-
- _open: function(event, menu) {
- // on a single-button menubar, ignore reopening the same menu
- if (this.active && this.active[0] == menu[0]) {
- return;
- }
- // almost the same as _close above, but don't remove tabIndex
- if (this.active) {
- this.active.menu("closeAll").hide().attr("aria-hidden", "true").attr("aria-expanded", "false");
- this.active.prev().removeClass("ui-state-active");
- }
- // set tabIndex -1 to have the button skipped on shift-tab when menu is open (it gets focus)
- var button = menu.prev().addClass("ui-state-active").attr("tabIndex", -1);
- this.active = menu.show().position({
- my: "left top",
- at: "left bottom",
- of: button
- })
- .removeAttr("aria-hidden").attr("aria-expanded", "true")
- .menu("focus", event, menu.children("li").first())
- .focus()
- .focusin()
- ;
- this.open = true;
- },
-
- _prev: function( event, button ) {
- button.attr("tabIndex", -1);
- var prev = button.parent().prevAll("li").children( ".ui-button" ).eq( 0 );
- if (prev.length) {
- prev.removeAttr("tabIndex")[0].focus();
- } else {
- var lastItem = this.element.children("li:last").children(".ui-button:last");
- lastItem.removeAttr("tabIndex")[0].focus();
- }
- },
-
- _next: function( event, button ) {
- button.attr("tabIndex", -1);
- var next = button.parent().nextAll("li").children( ".ui-button" ).eq( 0 );
- if (next.length) {
- next.removeAttr("tabIndex")[0].focus();
- } else {
- var firstItem = this.element.children("li:first").children(".ui-button:first");
- firstItem.removeAttr("tabIndex")[0].focus();
- }
- },
-
- _left: function(event) {
- var prev = this.active.parent().prevAll("li:eq(0)").children( ".ui-menu" ).eq( 0 );
- if (prev.length) {
- this._open(event, prev);
- } else {
- var lastItem = this.element.children("li:last").children(".ui-menu:first");
- this._open(event, lastItem);
- }
- },
-
- _right: function(event) {
- var next = this.active.parent().nextAll("li:eq(0)").children( ".ui-menu" ).eq( 0 );
- if (next.length) {
- this._open(event, next);
- } else {
- var firstItem = this.element.children("li:first").children(".ui-menu:first");
- this._open(event, firstItem);
- }
- }
-});
-
-}(jQuery));
diff --git a/tests/visual/menu/popup.html b/tests/visual/menu/popup.html
deleted file mode 100644
index 271002a20..000000000
--- a/tests/visual/menu/popup.html
+++ /dev/null
@@ -1,176 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Visual Test for Popup Utility</title>
- <link rel="stylesheet" href="../visual.css" type="text/css" />
- <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
- <script type="text/javascript" src="../../../jquery-1.5.1.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>
- <script type="text/javascript" src="../../../ui/jquery.ui.menu.js"></script>
- <script type="text/javascript" src="popup.js"></script>
- <!--
- <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
- -->
- <script type="text/javascript">
- $(function() {
- $.fn.themeswitcher && $('<div/>').css({
- position: "absolute",
- right: 10,
- top: 10
- }).appendTo(document.body).themeswitcher();
-
- var selected = {
- select: function( event, ui ) {
- $( "<div/>" ).text( "Selected: " + ui.item.text() ).appendTo( "#log" );
- $(this).hide();
- }
- };
-
- $("#members-popup").popup();
-
- $("#button1").button();
- $("#menu1").menu(selected).popup();
-
- $( "#rerun" )
- .button()
- .click(function() {
- alert( "Running the last action" );
- })
- .next()
- .button({
- text: false,
- icons: {
- primary: "ui-icon-triangle-1-s"
- }
- })
- .parent()
- .buttonset()
- .next()
- .menu(selected)
- .popup({
- trigger: $("#select")
- });
-
- $("td:has(.menubar)").clone().appendTo("tbody tr:not(:first)");
- $("table .menubar > ul").menu(selected).popup().prev().button();
- });
- </script>
- <style type="text/css">
- body { font-size:62.5%; }
-
- .ui-popup { position: absolute; z-index: 5000; }
- .ui-menu { width: 200px; }
-
- table {
- border-collapse: collapse;
- }
- th, td {
- padding: 0.5em;
- border: 1px solid black;
- }
-
- #members-popup {
- width: 200px; height: 150px; border: 1px solid gray; border-radius: 5px;
- box-shadow: 3px 3px 5px -1px rgba(0, 0, 0, 0.5);
- background: lightgray; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
- font-size: 120%; text-align: center; line-height: 150px;
- }
- </style>
-</head>
-<body>
-
-<div>
- <a href="#members-popup">Project members</a>
- <div id="members-popup" tabIndex="0">
- some form controls in here
- </div>
-</div>
-
-<button id="button1">Show context menu 1</button>
-<ul id="menu1">
- <li><a href="#">Amsterdam</a></li>
- <li><a href="#">Anaheim</a></li>
- <li><a href="#">Cologne</a></li>
- <li><a href="#">Frankfurt</a></li>
- <li><a href="#">Magdeburg</a></li>
- <li><a href="#">Munich</a></li>
- <li><a href="#">Utrecht</a></li>
- <li><a href="#">Zurich</a></li>
-</ul>
-
-
-<div>
- <div>
- <button id="rerun">Run last action</button>
- <button id="select">Select an action</button>
- </div>
- <ul>
- <li><a href="#">Open...</a></li>
- <li><a href="#">Save</a></li>
- <li><a href="#">Delete</a></li>
- </ul>
-</div>
-
-<table id="movies" class="ui-widget">
- <thead>
- <tr>
- <th data-field="Name" class="ui-widget-header">Name</th>
- <th data-field="ReleaseYear" class="ui-widget-header">Release Year</th>
- <th data-field="AverageRating" class="ui-widget-header">Average Rating</th>
- <th class="ui-widget-header"></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td class="ui-widget-content">Red Hot Chili Peppers: Funky Monks</td>
- <td class="ui-widget-content">1993</td>
- <td class="ui-widget-content">3.6</td>
- <td class="ui-widget-content">
- <div class="menubar">
- <a href="#">Options</a>
- <ul>
- <li><a href="#">Order...</a></li>
- <li class="ui-state-disabled">Write a Review...</li>
- <li><a href="#">Find Similar Movies...</a></li>
- <li>
- <a href="#">Rate</a>
- <ul>
- <li><a href="#">5 stars</a></li>
- <li><a href="#">4 stars</a></li>
- <li><a href="#">3 stars</a></li>
- <li><a href="#">2 stars</a></li>
- <li><a href="#">1 stars</a></li>
- </ul>
- </li>
- </ul>
- </div>
- </td>
- </tr>
- <tr>
- <td class="ui-widget-content">Rod Stewart: Storyteller 1984-1991</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.1</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Stevie Ray Vaughan and Double Trouble: Live at the El Mocambo 1983</td>
- <td class="ui-widget-content">1991</td>
- <td class="ui-widget-content">3.9</td>
- </tr>
- <tr>
- <td class="ui-widget-content">Spike and Mike's Sick &amp; Twisted Festival of Animation</td>
- <td class="ui-widget-content">1997</td>
- <td class="ui-widget-content">2.6</td>
- </tr>
- </tbody>
-</table>
-
-<div class="ui-widget" style="margin-top:2em; font-family:Arial">
- Log:
- <div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
-</div>
-
-</body>
-</html>
diff --git a/tests/visual/menu/popup.js b/tests/visual/menu/popup.js
deleted file mode 100644
index f57cba699..000000000
--- a/tests/visual/menu/popup.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * jQuery UI popup utility
- */
-(function($) {
-
-var idIncrement = 0;
-
-$.widget( "ui.popup", {
- options: {
- position: {
- my: "left top",
- at: "left bottom"
- }
- },
- _create: function() {
- if ( !this.options.trigger ) {
- this.options.trigger = this.element.prev();
- }
-
- if ( !this.element.attr( "id" ) ) {
- this.element.attr( "id", "ui-popup-" + idIncrement++ );
- this.generatedId = true;
- }
-
- if ( !this.element.attr( "role" ) ) {
- // TODO alternatives to tooltip are dialog and menu, all three aren't generic popups
- this.element.attr( "role", "tooltip" );
- this.generatedRole = true;
- }
-
- this.options.trigger
- .attr( "aria-haspopup", true )
- .attr( "aria-owns", this.element.attr( "id" ) );
-
- this.element
- .addClass("ui-popup")
- this._close();
-
- this._bind(this.options.trigger, {
- click: function( event ) {
- event.preventDefault();
- var that = this;
- setTimeout(function() {
- that._open( event );
- }, 1);
- }
- });
-
- this._bind(this.element, {
- blur: "_close"
- });
-
- this._bind({
- keyup: function( event ) {
- if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
- this._close( event );
- this.options.trigger.focus();
- }
- }
- });
-
- this._bind(document, {
- click: function( event ) {
- if (this.open && !$(event.target).closest(".ui-popup").length) {
- this._close( event );
- }
- }
- })
- },
-
- _destroy: function() {
- this.element
- .show()
- .removeClass( "ui-popup" )
- .removeAttr( "aria-hidden" )
- .removeAttr( "aria-expanded" );
-
- this.options.trigger
- .removeAttr( "aria-haspopup" )
- .removeAttr( "aria-owns" );
-
- if ( this.generatedId ) {
- this.element.removeAttr( "id" );
- }
- if ( this.generatedRole ) {
- this.element.removeAttr( "role" );
- }
- },
-
- _open: function( event ) {
- var position = $.extend( {}, {
- of: this.options.trigger
- }, this.options.position );
-
- this.element
- .show()
- .attr( "aria-hidden", false )
- .attr( "aria-expanded", true )
- .position( position )
- .focus();
-
- // take trigger out of tab order to allow shift-tab to skip trigger
- this.options.trigger.attr("tabindex", -1);
-
- this.open = true;
- this._trigger( "open", event );
- },
-
- _close: function( event ) {
- this.element
- .hide()
- .attr( "aria-hidden", true )
- .attr( "aria-expanded", false );
-
- this.options.trigger.attr("tabindex", 0);
-
- this.open = false;
- this._trigger( "close", event );
- }
-
-
-});
-
-}(jQuery));
diff --git a/ui/i18n/jquery.ui.datepicker-af.js b/ui/i18n/jquery.ui.datepicker-af.js
index 43fbf6cd8..0922ef7a1 100644
--- a/ui/i18n/jquery.ui.datepicker-af.js
+++ b/ui/i18n/jquery.ui.datepicker-af.js
@@ -1,4 +1,4 @@
-/* Afrikaans initialisation for the jQuery UI date picker plugin. */
+/* Afrikaans initialisation for the jQuery UI date picker plugin. */
/* Written by Renier Pretorius. */
jQuery(function($){
$.datepicker.regional['af'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-ar.js b/ui/i18n/jquery.ui.datepicker-ar.js
index db5773558..f24b3ff5a 100644
--- a/ui/i18n/jquery.ui.datepicker-ar.js
+++ b/ui/i18n/jquery.ui.datepicker-ar.js
@@ -1,4 +1,4 @@
-/* Arabic Translation for jQuery UI date picker plugin. */
+/* Arabic Translation for jQuery UI date picker plugin. */
/* Khaled Alhourani -- me@khaledalhourani.com */
/* NOTE: monthNames are the original months names and they are the Arabic names, not the new months name فبراير - يناير and there isn't any Arabic roots for these months */
jQuery(function($){
diff --git a/ui/i18n/jquery.ui.datepicker-az.js b/ui/i18n/jquery.ui.datepicker-az.js
index 0f60a7e1d..1101c8b91 100644
--- a/ui/i18n/jquery.ui.datepicker-az.js
+++ b/ui/i18n/jquery.ui.datepicker-az.js
@@ -1,4 +1,4 @@
-/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */
+/* Azerbaijani (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Jamil Najafov (necefov33@gmail.com). */
jQuery(function($) {
$.datepicker.regional['az'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-bg.js b/ui/i18n/jquery.ui.datepicker-bg.js
index ae850ef80..4e0ee2f50 100644
--- a/ui/i18n/jquery.ui.datepicker-bg.js
+++ b/ui/i18n/jquery.ui.datepicker-bg.js
@@ -1,4 +1,4 @@
-/* Bulgarian initialisation for the jQuery UI date picker plugin. */
+/* Bulgarian initialisation for the jQuery UI date picker plugin. */
/* Written by Stoyan Kyosev (http://svest.org). */
jQuery(function($){
$.datepicker.regional['bg'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-bs.js b/ui/i18n/jquery.ui.datepicker-bs.js
index 7be269ab2..d64573755 100644
--- a/ui/i18n/jquery.ui.datepicker-bs.js
+++ b/ui/i18n/jquery.ui.datepicker-bs.js
@@ -1,4 +1,4 @@
-/* Bosnian i18n for the jQuery UI date picker plugin. */
+/* Bosnian i18n for the jQuery UI date picker plugin. */
/* Written by Kenan Konjo. */
jQuery(function($){
$.datepicker.regional['bs'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-cs.js b/ui/i18n/jquery.ui.datepicker-cs.js
index 115b8c0e1..bf56baf01 100644
--- a/ui/i18n/jquery.ui.datepicker-cs.js
+++ b/ui/i18n/jquery.ui.datepicker-cs.js
@@ -1,4 +1,4 @@
-/* Czech initialisation for the jQuery UI date picker plugin. */
+/* Czech initialisation for the jQuery UI date picker plugin. */
/* Written by Tomas Muller (tomas@tomas-muller.net). */
jQuery(function($){
$.datepicker.regional['cs'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-da.js b/ui/i18n/jquery.ui.datepicker-da.js
index 6d2ddee59..fb2d3356d 100644
--- a/ui/i18n/jquery.ui.datepicker-da.js
+++ b/ui/i18n/jquery.ui.datepicker-da.js
@@ -1,4 +1,4 @@
-/* Danish initialisation for the jQuery UI date picker plugin. */
+/* Danish initialisation for the jQuery UI date picker plugin. */
/* Written by Jan Christensen ( deletestuff@gmail.com). */
jQuery(function($){
$.datepicker.regional['da'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-de.js b/ui/i18n/jquery.ui.datepicker-de.js
index 56203ed7a..52d6c82ce 100644
--- a/ui/i18n/jquery.ui.datepicker-de.js
+++ b/ui/i18n/jquery.ui.datepicker-de.js
@@ -1,4 +1,4 @@
-/* German initialisation for the jQuery UI date picker plugin. */
+/* German initialisation for the jQuery UI date picker plugin. */
/* Written by Milian Wolff (mail@milianw.de). */
jQuery(function($){
$.datepicker.regional['de'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-el.js b/ui/i18n/jquery.ui.datepicker-el.js
index 9542769d9..6d775f995 100644
--- a/ui/i18n/jquery.ui.datepicker-el.js
+++ b/ui/i18n/jquery.ui.datepicker-el.js
@@ -1,4 +1,4 @@
-/* Greek (el) initialisation for the jQuery UI date picker plugin. */
+/* Greek (el) initialisation for the jQuery UI date picker plugin. */
/* Written by Alex Cicovic (http://www.alexcicovic.com) */
jQuery(function($){
$.datepicker.regional['el'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-en-GB.js b/ui/i18n/jquery.ui.datepicker-en-GB.js
index aac7b6195..16a096e75 100644
--- a/ui/i18n/jquery.ui.datepicker-en-GB.js
+++ b/ui/i18n/jquery.ui.datepicker-en-GB.js
@@ -1,4 +1,4 @@
-/* English/UK initialisation for the jQuery UI date picker plugin. */
+/* English/UK initialisation for the jQuery UI date picker plugin. */
/* Written by Stuart. */
jQuery(function($){
$.datepicker.regional['en-GB'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-eo.js b/ui/i18n/jquery.ui.datepicker-eo.js
index 7201a2c9f..39e44fc57 100644
--- a/ui/i18n/jquery.ui.datepicker-eo.js
+++ b/ui/i18n/jquery.ui.datepicker-eo.js
@@ -1,4 +1,4 @@
-/* Esperanto initialisation for the jQuery UI date picker plugin. */
+/* Esperanto initialisation for the jQuery UI date picker plugin. */
/* Written by Olivier M. (olivierweb@ifrance.com). */
jQuery(function($){
$.datepicker.regional['eo'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-et.js b/ui/i18n/jquery.ui.datepicker-et.js
index f97311f31..92f81f637 100644
--- a/ui/i18n/jquery.ui.datepicker-et.js
+++ b/ui/i18n/jquery.ui.datepicker-et.js
@@ -1,4 +1,4 @@
-/* Estonian initialisation for the jQuery UI date picker plugin. */
+/* Estonian initialisation for the jQuery UI date picker plugin. */
/* Written by Mart Sõmermaa (mrts.pydev at gmail com). */
jQuery(function($){
$.datepicker.regional['et'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-eu.js b/ui/i18n/jquery.ui.datepicker-eu.js
index 5eaace880..4c40eebec 100644
--- a/ui/i18n/jquery.ui.datepicker-eu.js
+++ b/ui/i18n/jquery.ui.datepicker-eu.js
@@ -1,4 +1,4 @@
-/* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
+/* Euskarako oinarria 'UI date picker' jquery-ko extentsioarentzat */
/* Karrikas-ek itzulia (karrikas@karrikas.com) */
jQuery(function($){
$.datepicker.regional['eu'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-fa.js b/ui/i18n/jquery.ui.datepicker-fa.js
index c3252a548..1d7fbd23c 100644
--- a/ui/i18n/jquery.ui.datepicker-fa.js
+++ b/ui/i18n/jquery.ui.datepicker-fa.js
@@ -1,4 +1,4 @@
-/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
+/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
/* Javad Mowlanezhad -- jmowla@gmail.com */
/* Jalali calendar should supported soon! (Its implemented but I have to test it) */
jQuery(function($) {
diff --git a/ui/i18n/jquery.ui.datepicker-fo.js b/ui/i18n/jquery.ui.datepicker-fo.js
index 2548df836..9c848a04b 100644
--- a/ui/i18n/jquery.ui.datepicker-fo.js
+++ b/ui/i18n/jquery.ui.datepicker-fo.js
@@ -1,4 +1,4 @@
-/* Faroese initialisation for the jQuery UI date picker plugin */
+/* Faroese initialisation for the jQuery UI date picker plugin */
/* Written by Sverri Mohr Olsen, sverrimo@gmail.com */
jQuery(function($){
$.datepicker.regional['fo'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-fr-CH.js b/ui/i18n/jquery.ui.datepicker-fr-CH.js
index 04f9b033e..fec03a042 100644
--- a/ui/i18n/jquery.ui.datepicker-fr-CH.js
+++ b/ui/i18n/jquery.ui.datepicker-fr-CH.js
@@ -1,4 +1,4 @@
-/* Swiss-French initialisation for the jQuery UI date picker plugin. */
+/* Swiss-French initialisation for the jQuery UI date picker plugin. */
/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */
jQuery(function($){
$.datepicker.regional['fr-CH'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-fr.js b/ui/i18n/jquery.ui.datepicker-fr.js
index 74ea1c231..7e793639f 100644
--- a/ui/i18n/jquery.ui.datepicker-fr.js
+++ b/ui/i18n/jquery.ui.datepicker-fr.js
@@ -1,4 +1,4 @@
-/* French initialisation for the jQuery UI date picker plugin. */
+/* French initialisation for the jQuery UI date picker plugin. */
/* Written by Keith Wood (kbwood{at}iinet.com.au),
Stéphane Nahmani (sholby@sholby.net),
Stéphane Raimbault <stephane.raimbault@gmail.com> */
diff --git a/ui/i18n/jquery.ui.datepicker-he.js b/ui/i18n/jquery.ui.datepicker-he.js
index 429a11c2c..58ea8c6d8 100644
--- a/ui/i18n/jquery.ui.datepicker-he.js
+++ b/ui/i18n/jquery.ui.datepicker-he.js
@@ -1,4 +1,4 @@
-/* Hebrew initialisation for the UI Datepicker extension. */
+/* Hebrew initialisation for the UI Datepicker extension. */
/* Written by Amir Hardon (ahardon at gmail dot com). */
jQuery(function($){
$.datepicker.regional['he'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-hr.js b/ui/i18n/jquery.ui.datepicker-hr.js
index 61b7fccb1..6bc5aade1 100644
--- a/ui/i18n/jquery.ui.datepicker-hr.js
+++ b/ui/i18n/jquery.ui.datepicker-hr.js
@@ -1,4 +1,4 @@
-/* Croatian i18n for the jQuery UI date picker plugin. */
+/* Croatian i18n for the jQuery UI date picker plugin. */
/* Written by Vjekoslav Nesek. */
jQuery(function($){
$.datepicker.regional['hr'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-ja.js b/ui/i18n/jquery.ui.datepicker-ja.js
index ab9243bbd..afd298315 100644
--- a/ui/i18n/jquery.ui.datepicker-ja.js
+++ b/ui/i18n/jquery.ui.datepicker-ja.js
@@ -1,4 +1,4 @@
-/* Japanese initialisation for the jQuery UI date picker plugin. */
+/* Japanese initialisation for the jQuery UI date picker plugin. */
/* Written by Kentaro SATO (kentaro@ranvis.com). */
jQuery(function($){
$.datepicker.regional['ja'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-ml.js b/ui/i18n/jquery.ui.datepicker-ml.js
index 753dba411..1e3432c0a 100644
--- a/ui/i18n/jquery.ui.datepicker-ml.js
+++ b/ui/i18n/jquery.ui.datepicker-ml.js
@@ -1,4 +1,4 @@
-/* Malayalam (UTF-8) initialisation for the jQuery UI date picker plugin. */
+/* Malayalam (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Saji Nediyanchath (saji89@gmail.com). */
jQuery(function($){
$.datepicker.regional['ml'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-nl.js b/ui/i18n/jquery.ui.datepicker-nl.js
index 40be2cfa4..09634088b 100644
--- a/ui/i18n/jquery.ui.datepicker-nl.js
+++ b/ui/i18n/jquery.ui.datepicker-nl.js
@@ -1,4 +1,4 @@
-/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
+/* Dutch (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Mathias Bynens <http://mathiasbynens.be/> */
jQuery(function($){
$.datepicker.regional.nl = {
diff --git a/ui/i18n/jquery.ui.datepicker-ro.js b/ui/i18n/jquery.ui.datepicker-ro.js
index 9016b6712..a988270d7 100644
--- a/ui/i18n/jquery.ui.datepicker-ro.js
+++ b/ui/i18n/jquery.ui.datepicker-ro.js
@@ -1,4 +1,4 @@
-/* Romanian initialisation for the jQuery UI date picker plugin.
+/* Romanian initialisation for the jQuery UI date picker plugin.
*
* Written by Edmond L. (ll_edmond@walla.com)
* and Ionut G. Stan (ionut.g.stan@gmail.com)
diff --git a/ui/i18n/jquery.ui.datepicker-sq.js b/ui/i18n/jquery.ui.datepicker-sq.js
index 52f8eee0c..d6086a789 100644
--- a/ui/i18n/jquery.ui.datepicker-sq.js
+++ b/ui/i18n/jquery.ui.datepicker-sq.js
@@ -1,4 +1,4 @@
-/* Albanian initialisation for the jQuery UI date picker plugin. */
+/* Albanian initialisation for the jQuery UI date picker plugin. */
/* Written by Flakron Bytyqi (flakron@gmail.com). */
jQuery(function($){
$.datepicker.regional['sq'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-sr-SR.js b/ui/i18n/jquery.ui.datepicker-sr-SR.js
index 57ee8f24a..6d5d04211 100644
--- a/ui/i18n/jquery.ui.datepicker-sr-SR.js
+++ b/ui/i18n/jquery.ui.datepicker-sr-SR.js
@@ -1,4 +1,4 @@
-/* Serbian i18n for the jQuery UI date picker plugin. */
+/* Serbian i18n for the jQuery UI date picker plugin. */
/* Written by Dejan Dimić. */
jQuery(function($){
$.datepicker.regional['sr-SR'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-sr.js b/ui/i18n/jquery.ui.datepicker-sr.js
index 543dd0feb..d4e1d9af0 100644
--- a/ui/i18n/jquery.ui.datepicker-sr.js
+++ b/ui/i18n/jquery.ui.datepicker-sr.js
@@ -1,4 +1,4 @@
-/* Serbian i18n for the jQuery UI date picker plugin. */
+/* Serbian i18n for the jQuery UI date picker plugin. */
/* Written by Dejan Dimić. */
jQuery(function($){
$.datepicker.regional['sr'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-sv.js b/ui/i18n/jquery.ui.datepicker-sv.js
index 05aab3308..173689b2a 100644
--- a/ui/i18n/jquery.ui.datepicker-sv.js
+++ b/ui/i18n/jquery.ui.datepicker-sv.js
@@ -1,4 +1,4 @@
-/* Swedish initialisation for the jQuery UI date picker plugin. */
+/* Swedish initialisation for the jQuery UI date picker plugin. */
/* Written by Anders Ekdahl ( anders@nomadiz.se). */
jQuery(function($){
$.datepicker.regional['sv'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-ta.js b/ui/i18n/jquery.ui.datepicker-ta.js
index 91116d387..40431ed8e 100644
--- a/ui/i18n/jquery.ui.datepicker-ta.js
+++ b/ui/i18n/jquery.ui.datepicker-ta.js
@@ -1,4 +1,4 @@
-/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */
+/* Tamil (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by S A Sureshkumar (saskumar@live.com). */
jQuery(function($){
$.datepicker.regional['ta'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-th.js b/ui/i18n/jquery.ui.datepicker-th.js
index f2122fc9f..d57541f64 100644
--- a/ui/i18n/jquery.ui.datepicker-th.js
+++ b/ui/i18n/jquery.ui.datepicker-th.js
@@ -1,4 +1,4 @@
-/* Thai initialisation for the jQuery UI date picker plugin. */
+/* Thai initialisation for the jQuery UI date picker plugin. */
/* Written by pipo (pipo@sixhead.com). */
jQuery(function($){
$.datepicker.regional['th'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-vi.js b/ui/i18n/jquery.ui.datepicker-vi.js
index 3ecf36197..b49e7eb13 100644
--- a/ui/i18n/jquery.ui.datepicker-vi.js
+++ b/ui/i18n/jquery.ui.datepicker-vi.js
@@ -1,4 +1,4 @@
-/* Vietnamese initialisation for the jQuery UI date picker plugin. */
+/* Vietnamese initialisation for the jQuery UI date picker plugin. */
/* Translated by Le Thanh Huy (lthanhhuy@cit.ctu.edu.vn). */
jQuery(function($){
$.datepicker.regional['vi'] = {
diff --git a/ui/i18n/jquery.ui.datepicker-zh-TW.js b/ui/i18n/jquery.ui.datepicker-zh-TW.js
index 3c58ea92d..19702a65c 100644
--- a/ui/i18n/jquery.ui.datepicker-zh-TW.js
+++ b/ui/i18n/jquery.ui.datepicker-zh-TW.js
@@ -1,4 +1,4 @@
-/* Chinese initialisation for the jQuery UI date picker plugin. */
+/* Chinese initialisation for the jQuery UI date picker plugin. */
/* Written by Ressol (ressol@gmail.com). */
jQuery(function($){
$.datepicker.regional['zh-TW'] = {
diff --git a/ui/jquery.effects.bounce.js b/ui/jquery.effects.bounce.js
index 1ffd5ed5a..bb386a4f4 100644
--- a/ui/jquery.effects.bounce.js
+++ b/ui/jquery.effects.bounce.js
@@ -23,7 +23,7 @@ $.effects.effect.bounce = function(o) {
hide = mode === "hide",
show = mode === "show",
direction = o.direction || "up",
- distance = o.distance || 20,
+ distance = o.distance,
times = o.times || 5,
// number of internal animations
@@ -53,7 +53,7 @@ $.effects.effect.bounce = function(o) {
// default distance for the BIGGEST bounce is the outer Distance / 3
if ( !distance ) {
- distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]({ margin:true }) / 3;
+ distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
}
if ( show ) {
@@ -69,7 +69,7 @@ $.effects.effect.bounce = function(o) {
// start at the smallest distance if we are hiding
if ( hide ) {
- distance = distance / ( ( times - 1 ) * 2 );
+ distance = distance / Math.pow( 2, times - 1 );
}
downAnim = {};
diff --git a/ui/jquery.effects.pulsate.js b/ui/jquery.effects.pulsate.js
index 30c346abd..54c5c10af 100644
--- a/ui/jquery.effects.pulsate.js
+++ b/ui/jquery.effects.pulsate.js
@@ -18,9 +18,10 @@ $.effects.effect.pulsate = function( o ) {
mode = $.effects.setMode( elem, o.mode || "show" ),
show = mode === "show",
hide = mode === "hide",
+ showhide = ( show || mode === "hide" ),
// showing or hiding leaves of the "last" animation
- anims = ( ( o.times || 5 ) * 2 ) - ( show || hide ? 1 : 0 ),
+ anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
duration = o.duration / anims,
animateTo = 0,
queue = elem.queue(),
@@ -32,7 +33,8 @@ $.effects.effect.pulsate = function( o ) {
animateTo = 1;
}
- for ( i = 0; i < anims - 1; i++ ) {
+ // anims - 1 opacity "toggles"
+ for ( i = 1; i < anims; i++ ) {
elem.animate({
opacity: animateTo
}, duration, o.easing );
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 526eb3869..b3d7598c1 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -62,6 +62,7 @@ $.widget( "ui.autocomplete", {
})
.bind( "keydown.autocomplete", function( event ) {
if ( self.options.disabled || self.element.attr( "readonly" ) ) {
+ suppressKeyPress = true;
return;
}
@@ -69,17 +70,21 @@ $.widget( "ui.autocomplete", {
var keyCode = $.ui.keyCode;
switch( event.keyCode ) {
case keyCode.PAGE_UP:
+ suppressKeyPress = true;
self._move( "previousPage", event );
break;
case keyCode.PAGE_DOWN:
+ suppressKeyPress = true;
self._move( "nextPage", event );
break;
case keyCode.UP:
+ suppressKeyPress = true;
self._move( "previous", event );
// prevent moving cursor to beginning of text field in some browsers
event.preventDefault();
break;
case keyCode.DOWN:
+ suppressKeyPress = true;
self._move( "next", event );
// prevent moving cursor to end of text field in some browsers
event.preventDefault();
@@ -121,7 +126,29 @@ $.widget( "ui.autocomplete", {
if ( suppressKeyPress ) {
suppressKeyPress = false;
event.preventDefault();
+ return;
}
+
+ // replicate some key handlers to allow them to repeat in Firefox and Opera
+ var keyCode = $.ui.keyCode;
+ switch( event.keyCode ) {
+ case keyCode.PAGE_UP:
+ self._move( "previousPage", event );
+ break;
+ case keyCode.PAGE_DOWN:
+ self._move( "nextPage", event );
+ break;
+ case keyCode.UP:
+ self._move( "previous", event );
+ // prevent moving cursor to beginning of text field in some browsers
+ event.preventDefault();
+ break;
+ case keyCode.DOWN:
+ self._move( "next", event );
+ // prevent moving cursor to end of text field in some browsers
+ event.preventDefault();
+ break;
+ }
})
.bind( "focus.autocomplete", function() {
if ( self.options.disabled ) {
@@ -338,6 +365,7 @@ $.widget( "ui.autocomplete", {
this.menu.element.hide();
this.menu.blur();
this._trigger( "close", event );
+ this.menu.isNewMenu = true;
}
},
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 5777d4753..031ac2091 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -103,6 +103,11 @@ $.widget( "ui.button", {
})
.bind( "blur.button", function() {
$( this ).removeClass( focusClass );
+ })
+ .bind( "click.button", function( event ) {
+ if ( options.disabled ) {
+ event.stopImmediatePropagation();
+ }
});
if ( toggleButton ) {
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index 3437d0bda..12323672a 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -648,7 +648,6 @@ $.extend(Datepicker.prototype, {
var showAnim = $.datepicker._get(inst, 'showAnim');
var duration = $.datepicker._get(inst, 'duration');
var postProcess = function() {
- $.datepicker._datepickerShowing = true;
var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
if( !! cover.length ){
var borders = $.datepicker._getBorders(inst.dpDiv);
@@ -657,6 +656,7 @@ $.extend(Datepicker.prototype, {
}
};
inst.dpDiv.zIndex($(input).zIndex()+1);
+ $.datepicker._datepickerShowing = true;
// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
@@ -685,10 +685,9 @@ $.extend(Datepicker.prototype, {
var numMonths = this._getNumberOfMonths(inst);
var cols = numMonths[1];
var width = 17;
+ inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
if (cols > 1)
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
- else
- inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
'Class']('ui-datepicker-multi');
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
@@ -996,14 +995,24 @@ $.extend(Datepicker.prototype, {
};
// Extract a name from the string value and convert to an index
var getName = function(match, shortNames, longNames) {
- var names = (lookAhead(match) ? longNames : shortNames);
- for (var i = 0; i < names.length; i++) {
- if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
- iValue += names[i].length;
- return i + 1;
+ var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+ return [ [k, v] ];
+ }).sort(function (a, b) {
+ return -(a[1].length - b[1].length);
+ });
+ var index = -1;
+ $.each(names, function (i, pair) {
+ var name = pair[1];
+ if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
+ index = pair[0];
+ iValue += name.length;
+ return false;
}
- }
- throw 'Unknown name at position ' + iValue;
+ });
+ if (index != -1)
+ return index + 1;
+ else
+ throw 'Unknown name at position ' + iValue;
};
// Confirm that a literal character matches the string value
var checkLiteral = function() {
diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js
index 8423d1164..2138a9a58 100644
--- a/ui/jquery.ui.dialog.js
+++ b/ui/jquery.ui.dialog.js
@@ -281,7 +281,7 @@ $.widget("ui.dialog", {
options = self.options,
uiDialog = self.uiDialog;
- self.overlay = options.modal ? new $.ui.dialog.overlay( self ) : null;
+ self.overlay = options.modal ? new $.ui.dialog.overlay( self ) : null;
self._size();
self._position( options.position );
uiDialog.show( options.show );
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 0841018af..3cc25062c 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -18,6 +18,7 @@ var idIncrement = 0;
$.widget("ui.menu", {
defaultElement: "<ul>",
delay: 150,
+ isNewMenu: true,
options: {
position: {
my: "left top",
@@ -54,7 +55,8 @@ $.widget("ui.menu", {
self.select( event );
})
.bind( "mouseover.menu", function( event ) {
- if ( self.options.disabled ) {
+ if ( self.options.disabled || self.isNewMenu ) {
+ self.isNewMenu = false;
return;
}
var target = $( event.target ).closest( ".ui-menu-item" );
diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js
new file mode 100644
index 000000000..2879d079c
--- /dev/null
+++ b/ui/jquery.ui.menubar.js
@@ -0,0 +1,272 @@
+/*
+ * jQuery UI Menubar @VERSION
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Menubar
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ * jquery.ui.menu.js
+ */
+(function( $ ) {
+
+// TODO when mixing clicking menus and keyboard navigation, focus handling is broken
+// there has to be just one item that has tabindex
+$.widget( "ui.menubar", {
+ options: {
+ buttons: false,
+ menuIcon: false
+ },
+ _create: function() {
+ var that = this;
+ var items = this.items = this.element.children( "li" )
+ .addClass( "ui-menubar-item" )
+ .attr( "role", "presentation" )
+ .children( "button, a" );
+ // let only the first item receive focus
+ items.slice(1).attr( "tabIndex", -1 );
+
+ this.element
+ .addClass( "ui-menubar ui-widget-header ui-helper-clearfix" )
+ .attr( "role", "menubar" );
+ this._focusable( items );
+ this._hoverable( items );
+ items.next( "ul" )
+ .menu({
+ select: function( event, ui ) {
+ ui.item.parents( "ul.ui-menu:last" ).hide();
+ that._trigger( "select", event, ui );
+ that._close();
+ // TODO what is this targetting? there's probably a better way to access it
+ $(event.target).prev().focus();
+ }
+ })
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" )
+ .bind( "keydown.menubar", function( event ) {
+ var menu = $( this );
+ if ( menu.is( ":hidden" ) )
+ return;
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.LEFT:
+ that._left( event );
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.RIGHT:
+ that._right( event );
+ event.preventDefault();
+ break;
+ };
+ });
+ items.each(function() {
+ var input = $(this),
+ // TODO menu var is only used on two places, doesn't quite justify the .each
+ menu = input.next( "ul" );
+
+ input.bind( "click.menubar focus.menubar mouseenter.menubar", function( event ) {
+ // ignore triggered focus event
+ if ( event.type == "focus" && !event.originalEvent ) {
+ return;
+ }
+ event.preventDefault();
+ // TODO can we simplify or extractthis check? especially the last two expressions
+ // there's a similar active[0] == menu[0] check in _open
+ if ( event.type == "click" && menu.is( ":visible" ) && that.active && that.active[0] == menu[0] ) {
+ that._close();
+ return;
+ }
+ if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" ) {
+ that._open( event, menu );
+ }
+ })
+ .bind( "keydown", function( event ) {
+ switch ( event.keyCode ) {
+ case $.ui.keyCode.SPACE:
+ case $.ui.keyCode.UP:
+ case $.ui.keyCode.DOWN:
+ that._open( event, $( this ).next() );
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.LEFT:
+ that._prev( event, $( this ) );
+ event.preventDefault();
+ break;
+ case $.ui.keyCode.RIGHT:
+ that._next( event, $( this ) );
+ event.preventDefault();
+ break;
+ }
+ })
+ .addClass( "ui-button ui-widget ui-button-text-only ui-menubar-link" )
+ .attr( "role", "menuitem" )
+ .attr( "aria-haspopup", "true" )
+ .wrapInner( "<span class='ui-button-text'></span>" );
+
+ // TODO review if these options are a good choice, maybe they can be merged
+ if ( that.options.menuIcon ) {
+ input.addClass( "ui-state-default" ).append( "<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>" );
+ input.removeClass( "ui-button-text-only" ).addClass( "ui-button-text-icon-secondary" );
+ }
+
+ if ( !that.options.buttons ) {
+ // TODO ui-menubar-link is added above, not needed here?
+ input.addClass( "ui-menubar-link" ).removeClass( "ui-state-default" );
+ };
+
+ });
+ that._bind( {
+ keydown: function( event ) {
+ if ( event.keyCode == $.ui.keyCode.ESCAPE && that.active && that.active.menu( "left", event ) !== true ) {
+ var active = that.active;
+ that.active.blur();
+ that._close( event );
+ active.prev().focus();
+ }
+ },
+ focusin: function( event ) {
+ clearTimeout( that.closeTimer );
+ },
+ focusout: function( event ) {
+ that.closeTimer = setTimeout( function() {
+ that._close( event );
+ }, 100);
+ }
+ });
+ },
+
+ _destroy : function() {
+ var items = this.element.children( "li" )
+ .removeClass( "ui-menubar-item" )
+ .removeAttr( "role", "presentation" )
+ .children( "button, a" );
+
+ this.element
+ .removeClass( "ui-menubar ui-widget-header ui-helper-clearfix" )
+ .removeAttr( "role", "menubar" )
+ .unbind( ".menubar" );
+
+ items
+ .unbind( ".menubar" )
+ .removeClass( "ui-button ui-widget ui-button-text-only ui-menubar-link ui-state-default" )
+ .removeAttr( "role", "menuitem" )
+ .removeAttr( "aria-haspopup", "true" )
+ // TODO unwrap?
+ .children( "span.ui-button-text" ).each(function( i, e ) {
+ var item = $( this );
+ item.parent().html( item.html() );
+ })
+ .end()
+ .children( ".ui-icon" ).remove();
+
+ this.element.find( ":ui-menu" )
+ .menu( "destroy" )
+ .show()
+ .removeAttr( "aria-hidden", "true" )
+ .removeAttr( "aria-expanded", "false" )
+ .removeAttr( "tabindex" )
+ .unbind( ".menubar" );
+ },
+
+ _close: function() {
+ if ( !this.active || !this.active.length )
+ return;
+ this.active
+ .menu( "closeAll" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" );
+ this.active
+ .prev()
+ .removeClass( "ui-state-active" )
+ .removeAttr( "tabIndex" );
+ this.active = null;
+ this.open = false;
+ },
+
+ _open: function( event, menu ) {
+ // on a single-button menubar, ignore reopening the same menu
+ if ( this.active && this.active[0] == menu[0] ) {
+ return;
+ }
+ // TODO refactor, almost the same as _close above, but don't remove tabIndex
+ if ( this.active ) {
+ this.active
+ .menu( "closeAll" )
+ .hide()
+ .attr( "aria-hidden", "true" )
+ .attr( "aria-expanded", "false" );
+ this.active
+ .prev()
+ .removeClass( "ui-state-active" );
+ }
+ // set tabIndex -1 to have the button skipped on shift-tab when menu is open (it gets focus)
+ var button = menu.prev().addClass( "ui-state-active" ).attr( "tabIndex", -1 );
+ this.active = menu
+ .show()
+ .position( {
+ my: "left top",
+ at: "left bottom",
+ of: button
+ })
+ .removeAttr( "aria-hidden" )
+ .attr( "aria-expanded", "true" )
+ .menu("focus", event, menu.children( "li" ).first() )
+ // TODO need a comment here why both events are triggered
+ .focus()
+ .focusin();
+ this.open = true;
+ },
+
+ // TODO refactor this and the next three methods
+ _prev: function( event, button ) {
+ button.attr( "tabIndex", -1 );
+ var prev = button.parent().prevAll( "li" ).children( ".ui-button" ).eq( 0 );
+ if ( prev.length ) {
+ prev.removeAttr( "tabIndex" )[0].focus();
+ } else {
+ var lastItem = this.element.children( "li:last" ).children( ".ui-button:last" );
+ lastItem.removeAttr( "tabIndex" )[0].focus();
+ }
+ },
+
+ _next: function( event, button ) {
+ button.attr( "tabIndex", -1 );
+ var next = button.parent().nextAll( "li" ).children( ".ui-button" ).eq( 0 );
+ if ( next.length ) {
+ next.removeAttr( "tabIndex")[0].focus();
+ } else {
+ var firstItem = this.element.children( "li:first" ).children( ".ui-button:first" );
+ firstItem.removeAttr( "tabIndex" )[0].focus();
+ }
+ },
+
+ // TODO rename to parent
+ _left: function( event ) {
+ var prev = this.active.parent().prevAll( "li:eq(0)" ).children( ".ui-menu" ).eq( 0 );
+ if ( prev.length ) {
+ this._open( event, prev );
+ } else {
+ var lastItem = this.element.children( "li:last" ).children( ".ui-menu:first" );
+ this._open( event, lastItem );
+ }
+ },
+
+ // TODO rename to child (or something like that)
+ _right: function( event ) {
+ var next = this.active.parent().nextAll( "li:eq(0)" ).children( ".ui-menu" ).eq( 0 );
+ if ( next.length ) {
+ this._open( event, next );
+ } else {
+ var firstItem = this.element.children( "li:first" ).children( ".ui-menu:first" );
+ this._open( event, firstItem );
+ }
+ }
+});
+
+}( jQuery ));
diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js
index bfe4a7578..0bd38db85 100644
--- a/ui/jquery.ui.mouse.js
+++ b/ui/jquery.ui.mouse.js
@@ -12,6 +12,11 @@
*/
(function( $, undefined ) {
+var mouseHandled = false;
+$(document).mousedown(function(e) {
+ mouseHandled = false;
+});
+
$.widget("ui.mouse", {
options: {
cancel: ':input,option',
@@ -44,9 +49,7 @@ $.widget("ui.mouse", {
_mouseDown: function(event) {
// don't let more than one widget handle mouseStart
- // TODO: figure out why we have to use originalEvent
- event.originalEvent = event.originalEvent || {};
- if (event.originalEvent.mouseHandled) { return; }
+ if(mouseHandled) {return};
// we may have missed mouseup (out of window)
(this._mouseStarted && this._mouseUp(event));
@@ -92,7 +95,8 @@ $.widget("ui.mouse", {
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
event.preventDefault();
- event.originalEvent.mouseHandled = true;
+
+ mouseHandled = true;
return true;
},
diff --git a/ui/jquery.ui.popup.js b/ui/jquery.ui.popup.js
new file mode 100644
index 000000000..10361a35c
--- /dev/null
+++ b/ui/jquery.ui.popup.js
@@ -0,0 +1,174 @@
+/*
+ * jQuery UI Popup @VERSION
+ *
+ * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Popup
+ *
+ * Depends:
+ * jquery.ui.core.js
+ * jquery.ui.widget.js
+ * jquery.ui.position.js
+ */
+(function($) {
+
+var idIncrement = 0;
+
+$.widget( "ui.popup", {
+ options: {
+ position: {
+ my: "left top",
+ at: "left bottom"
+ }
+ },
+ _create: function() {
+ if ( !this.options.trigger ) {
+ this.options.trigger = this.element.prev();
+ }
+
+ if ( !this.element.attr( "id" ) ) {
+ this.element.attr( "id", "ui-popup-" + idIncrement++ );
+ this.generatedId = true;
+ }
+
+ if ( !this.element.attr( "role" ) ) {
+ // TODO alternatives to tooltip are dialog and menu, all three aren't generic popups
+ this.element.attr( "role", "tooltip" );
+ this.generatedRole = true;
+ }
+
+ this.options.trigger
+ .attr( "aria-haspopup", true )
+ .attr( "aria-owns", this.element.attr( "id" ) );
+
+ this.element
+ .addClass("ui-popup")
+ this.close();
+
+ this._bind(this.options.trigger, {
+ keydown: function( event ) {
+ // prevent space-to-open to scroll the page, only hapens for anchor ui.button
+ if ( this.options.trigger.is( "a:ui-button" ) && event.keyCode == $.ui.keyCode.SPACE) {
+ event.preventDefault()
+ }
+ // TODO handle SPACE to open popup? only when not handled by ui.button
+ if ( event.keyCode == $.ui.keyCode.SPACE && this.options.trigger.is("a:not(:ui-button)") ) {
+ this.options.trigger.trigger( "click", event );
+ }
+ // translate keydown to click
+ // opens popup and let's tooltip hide itself
+ if ( event.keyCode == $.ui.keyCode.DOWN ) {
+ // prevent scrolling
+ event.preventDefault();
+ this.options.trigger.trigger( "click", event );
+ }
+ },
+ click: function( event ) {
+ event.preventDefault();
+ if (this.isOpen) {
+ // let it propagate to close
+ return;
+ }
+ var that = this;
+ clearTimeout( this.closeTimer );
+ setTimeout(function() {
+ that.open( event );
+ }, 1);
+ }
+ });
+
+ this._bind(this.element, {
+ // TODO use focusout so that element itself doesn't need to be focussable
+ blur: function( event ) {
+ var that = this;
+ // use a timer to allow click to clear it and letting that
+ // handle the closing instead of opening again
+ that.closeTimer = setTimeout( function() {
+ that.close( event );
+ }, 100);
+ }
+ });
+
+ this._bind({
+ // TODO only triggerd on element if it can receive focus
+ // bind to document instead?
+ // either element itself or a child should be focusable
+ keyup: function( event ) {
+ if (event.keyCode == $.ui.keyCode.ESCAPE && this.element.is( ":visible" )) {
+ this.close( event );
+ // TODO move this to close()? would allow menu.select to call popup.close, and get focus back to trigger
+ this.options.trigger.focus();
+ }
+ }
+ });
+
+ this._bind(document, {
+ click: function( event ) {
+ if (this.isOpen && !$(event.target).closest(".ui-popup").length) {
+ this.close( event );
+ }
+ }
+ })
+ },
+
+ _destroy: function() {
+ this.element
+ .show()
+ .removeClass( "ui-popup" )
+ .removeAttr( "aria-hidden" )
+ .removeAttr( "aria-expanded" );
+
+ this.options.trigger
+ .removeAttr( "aria-haspopup" )
+ .removeAttr( "aria-owns" );
+
+ if ( this.generatedId ) {
+ this.element.removeAttr( "id" );
+ }
+ if ( this.generatedRole ) {
+ this.element.removeAttr( "role" );
+ }
+ },
+
+ open: function( event ) {
+ var position = $.extend( {}, {
+ of: this.options.trigger
+ }, this.options.position );
+
+ this.element
+ .show()
+ .attr( "aria-hidden", false )
+ .attr( "aria-expanded", true )
+ .position( position )
+ // TODO find a focussable child, otherwise put focus on element, add tabIndex=0 if not focussable
+ .focus();
+
+ if (this.element.is(":ui-menu")) {
+ this.element.menu("focus", event, this.element.children( "li" ).first() );
+ }
+
+ // take trigger out of tab order to allow shift-tab to skip trigger
+ this.options.trigger.attr("tabindex", -1);
+
+ this.isOpen = true;
+ this._trigger( "open", event );
+ },
+
+ close: function( event ) {
+ this.element
+ .hide()
+ .attr( "aria-hidden", true )
+ .attr( "aria-expanded", false );
+
+ this.options.trigger.attr("tabindex", 0);
+
+ this.isOpen = false;
+ this._trigger( "close", event );
+ }
+
+
+});
+
+}(jQuery));
diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js
index 1e1706a9d..e0579ef84 100644
--- a/ui/jquery.ui.resizable.js
+++ b/ui/jquery.ui.resizable.js
@@ -176,10 +176,12 @@ $.widget("ui.resizable", $.ui.mouse, {
$(this.element)
.addClass("ui-resizable-autohide")
.hover(function() {
+ if (o.disabled) return;
$(this).removeClass("ui-resizable-autohide");
self._handles.show();
},
function(){
+ if (o.disabled) return;
if (!self.resizing) {
$(this).addClass("ui-resizable-autohide");
self._handles.hide();
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 58c181670..cce50d3e7 100755..100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -108,15 +108,7 @@ $.widget( "ui.tabs", {
var panel = that._getPanelForTab( this.active );
panel.show();
-
this.lis.eq( options.active ).addClass( "ui-tabs-active ui-state-active" );
-
- // TODO: we need to remove this or add it to accordion
- // seems to be expected behavior that the activate callback is fired
- that.element.queue( "tabs", function() {
- that._trigger( "activate", null, that._ui( that.active[ 0 ], panel[ 0 ] ) );
- });
-
this.load( options.active );
} else {
this.active = $();
@@ -161,14 +153,6 @@ $.widget( "ui.tabs", {
return hash ? hash.replace( /:/g, "\\:" ) : "";
},
- _ui: function( tab, panel ) {
- return {
- tab: tab,
- panel: panel,
- index: this.anchors.index( tab )
- };
- },
-
refresh: function() {
var self = this,
options = this.options,
@@ -621,6 +605,7 @@ $.widget( "ui.tabs", {
this.xhr
.success(function( response ) {
panel.html( response );
+ self._trigger( "load", event, eventData );
})
.complete(function( jqXHR, status ) {
if ( status === "abort" ) {
@@ -631,13 +616,11 @@ $.widget( "ui.tabs", {
// "tabs" queue must not contain more than two elements,
// which are the callbacks for the latest clicked tab...
self.element.queue( "tabs", self.element.queue( "tabs" ).splice( -2, 2 ) );
-
- delete this.xhr;
}
self.lis.eq( index ).removeClass( "ui-tabs-loading" );
- self._trigger( "load", event, eventData );
+ delete self.xhr;
});
}
@@ -660,6 +643,15 @@ $.extend( $.ui.tabs, {
// DEPRECATED
if ( $.uiBackCompat !== false ) {
+ // helper method for a lot of the back compat extensions
+ $.ui.tabs.prototype._ui = function( tab, panel ) {
+ return {
+ tab: tab,
+ panel: panel,
+ index: this.anchors.index( tab )
+ };
+ };
+
// url method
(function( $, prototype ) {
prototype.url = function( index, url ) {
@@ -705,7 +697,7 @@ if ( $.uiBackCompat !== false ) {
}
});
- ui.jqXHR.success( function() {
+ ui.jqXHR.success(function() {
if ( self.options.cache ) {
$.data( ui.tab[ 0 ], "cache.tabs", true );
}
@@ -743,34 +735,28 @@ if ( $.uiBackCompat !== false ) {
}( jQuery, jQuery.ui.tabs.prototype ) );
// spinner
- (function( $, prototype ) {
- $.extend( prototype.options, {
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
spinner: "<em>Loading&#8230;</em>"
- });
-
- var _create = prototype._create;
- prototype._create = function() {
- _create.call( this );
- var self = this;
-
- this.element.bind( "tabsbeforeload", function( event, ui ) {
- if ( self.options.spinner ) {
- var span = $( "span", ui.tab );
- if ( span.length ) {
- span.data( "label.tabs", span.html() ).html( self.options.spinner );
+ },
+ _create: function() {
+ this._super( "_create" );
+ this._bind({
+ tabsbeforeload: function( event, ui ) {
+ if ( !this.options.spinner ) {
+ return;
}
+
+ var span = ui.tab.find( "span" ),
+ html = span.html();
+ span.html( this.options.spinner );
+ ui.jqXHR.complete(function() {
+ span.html( html );
+ });
}
- ui.jqXHR.complete( function() {
- if ( self.options.spinner ) {
- var span = $( "span", ui.tab );
- if ( span.length ) {
- span.html( span.data( "label.tabs" ) ).removeData( "label.tabs" );
- }
- }
- });
});
- };
- }( jQuery, jQuery.ui.tabs.prototype ) );
+ }
+ });
// enable/disable events
(function( $, prototype ) {
@@ -975,21 +961,33 @@ if ( $.uiBackCompat !== false ) {
show: null,
select: null
});
- var _trigger = prototype._trigger;
+ var _create = prototype._create,
+ _trigger = prototype._trigger;
+ prototype._create = function() {
+ _create.call( this );
+ if ( this.options.active !== false ) {
+ this._trigger( "show", null, this._ui(
+ this.active[ 0 ], this._getPanelForTab( this.active )[ 0 ] ) );
+ }
+ }
prototype._trigger = function( type, event, data ) {
var ret = _trigger.apply( this, arguments );
if ( !ret ) {
return false;
}
- if ( type === "beforeActivate" ) {
+ if ( type === "beforeActivate" && data.newTab.length ) {
ret = _trigger.call( this, "select", event, {
tab: data.newTab[ 0],
panel: data.newPanel[ 0 ],
index: data.newTab.closest( "li" ).index()
});
- } else if ( type === "activate" ) {
- ret = _trigger.call( this, "show", event, data );
+ } else if ( type === "activate" && data.newTab.length ) {
+ ret = _trigger.call( this, "show", event, {
+ tab: data.newTab[ 0 ],
+ panel: data.newPanel[ 0 ],
+ index: data.newTab.closest( "li" ).index()
+ });
}
};
}( jQuery, jQuery.ui.tabs.prototype ) );
@@ -1010,57 +1008,50 @@ if ( $.uiBackCompat !== false ) {
}( jQuery, jQuery.ui.tabs.prototype ) );
// cookie option
- (function( $, prototype ) {
- $.extend( prototype.options, {
+ $.widget( "ui.tabs", $.ui.tabs, {
+ options: {
cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
- });
-
- var _create = prototype._create,
- _refresh = prototype._refresh,
- _eventHandler = prototype._eventHandler,
- _destroy = prototype._destroy;
-
- prototype._create = function() {
- var o = this.options;
- if ( o.active === undefined ) {
- if ( typeof o.active !== "number" && o.cookie ) {
- o.active = parseInt( this._cookie(), 10 );
+ },
+ _create: function() {
+ var options = this.options,
+ active;
+ if ( options.active == null && options.cookie ) {
+ active = parseInt( this._cookie(), 10 );
+ if ( active === -1 ) {
+ active = false;
}
+ options.active = active;
}
- _create.call( this );
- };
-
- prototype._cookie = function() {
- var cookie = this.cookie ||
- ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
- return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
- };
-
- prototype._refresh = function() {
- _refresh.call( this );
-
- // set or update cookie after init and add/remove respectively
+ this._super( "_create" );
+ },
+ _cookie: function( active ) {
+ var cookie = [ this.cookie ||
+ ( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() ) ];
+ if ( arguments.length ) {
+ cookie.push( active === false ? -1 : active );
+ cookie.push( this.options.cookie );
+ }
+ return $.cookie.apply( null, cookie );
+ },
+ _refresh: function() {
+ this._super( "_refresh" );
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
}
- };
-
- prototype._eventHandler = function( event ) {
- _eventHandler.apply( this, arguments );
-
+ },
+ _eventHandler: function( event ) {
+ this._superApply( "_eventHandler", arguments );
if ( this.options.cookie ) {
this._cookie( this.options.active, this.options.cookie );
}
- };
-
- prototype._destroy = function() {
- _destroy.call( this );
-
+ },
+ _destroy: function() {
+ this._super( "_destroy" );
if ( this.options.cookie ) {
this._cookie( null, this.options.cookie );
}
- };
- }( jQuery, jQuery.ui.tabs.prototype ) );
+ }
+ });
}
})( jQuery );
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
index 20638cba5..a8a44f1c0 100644
--- a/ui/jquery.ui.tooltip.js
+++ b/ui/jquery.ui.tooltip.js
@@ -96,7 +96,8 @@ $.widget("ui.tooltip", {
this._bind( target, {
mouseleave: "close",
- blur: "close"
+ blur: "close",
+ click: "close"
});
},