Skip to content

Commit ac54556

Browse files
committed
Merge branch 'master' of github.com:jquery/jquery-ui into selectmenu
2 parents d7e23ce + 647bab5 commit ac54556

15 files changed

+141
-50
lines changed

demos/popup/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<h4>Examples</h4>
1111
<ul>
1212
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
13+
<li><a href="tooltip.html">Popup on hover (tooltip)</a></li>
1314
<li><a href="animation.html">Popup - show/hide effects</a></li>
1415
<li><a href="popup-menu.html">Menu's as popup</a></li>
1516
<li><a href="popup-menu-table.html">Menu's as popup in a table</a></li>

demos/popup/tooltip.html

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>jQuery UI Popup - Tooltip style demo</title>
5+
<link rel="stylesheet" href="../demos.css" />
6+
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css" title="ui-theme" />
7+
<script src="../../jquery-1.6.2.js"></script>
8+
<script src="../../ui/jquery.ui.core.js"></script>
9+
<script src="../../ui/jquery.ui.widget.js"></script>
10+
<script src="../../ui/jquery.ui.position.js"></script>
11+
<script src="../../ui/jquery.ui.button.js"></script>
12+
<script src="../../ui/jquery.ui.popup.js"></script>
13+
<script>
14+
$(function() {
15+
$("#more-info").popup({
16+
position: {
17+
of: "#info-link"
18+
}
19+
});
20+
21+
$( "#info-link" ).hover(
22+
function( event ) {
23+
$("#more-info").popup( "open" );
24+
},
25+
function( event ) {
26+
$("#more-info").popup( "close" );
27+
}
28+
);
29+
});
30+
</script>
31+
<style type="text/css">
32+
.ui-icon {
33+
display: inline-block;
34+
}
35+
#more-info {
36+
width: 11em;
37+
border: 1px solid gray;
38+
border-radius: 5px;
39+
padding: 1em;
40+
box-shadow: 3px 3px 5px -1px rgba(0, 0, 0, 0.5);
41+
background: lightgray; background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ddd));
42+
font-size: 1.3em; outline: none;
43+
position: absolute;
44+
z-index: 5000;
45+
display: none;
46+
}
47+
</style>
48+
</head>
49+
<body>
50+
51+
<div class="demo">
52+
<div>
53+
<textarea>More info about me to the right -></textarea> <span id="info-link" class="ui-icon ui-icon-info" />
54+
</div>
55+
<div id="more-info">This is some more info</div>
56+
</div>
57+
58+
<div class="demo-description">
59+
60+
<p>A "more info" popup that works on mouseover (tooltip).</p>
61+
62+
</div><!-- End demo-description -->
63+
64+
65+
</body>
66+
</html>

demos/tooltip/tracking.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
<script>
2020
$(function() {
2121
$( ".demo" ).tooltip({
22+
position: {
23+
my: "left+25 center",
24+
at: "center"
25+
},
2226
open: function( event ) {
23-
var tooltip = $( ".ui-tooltip" );
27+
var tooltip = $( ".ui-tooltip" ),
28+
positionOption = $( this ).tooltip( "option", "position" );
2429
function position( event ) {
25-
tooltip.position({
26-
my: "left+25 center",
27-
at: "right+25 center",
28-
of: event
29-
});
30+
positionOption.of = event;
31+
tooltip.position( positionOption );
3032
}
3133
$( document ).bind( "mousemove.tooltip-position", position );
3234
// trigger once to override element-relative positioning

tests/unit/effects/effects_core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ asyncTest( "animateClass clears style properties when stopped", function() {
143143
expect( 2 );
144144

145145
test.addClass( "testChangeBackground", duration );
146-
notEqual( orig, style.cssText, "cssText is the not the same after starting animation" );
146+
notEqual( orig, style.cssText, "cssText is not the same after starting animation" );
147147

148148
test.stop( true, true );
149-
equal( orig, style.cssText, "cssText is the same after stopping animation midway" );
149+
equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" );
150150
start();
151151
});
152152

tests/unit/spinner/spinner.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<script src="../../jquery.js"></script>
1010
<script src="../../../external/jquery.mousewheel-3.0.4.js"></script>
1111
<script src="../../../external/globalize.js"></script>
12+
<script src="../../../external/globalize.culture.ja-JP.js"></script>
1213
<script src="../../../ui/jquery.ui.core.js"></script>
1314
<script src="../../../ui/jquery.ui.widget.js"></script>
1415
<script src="../../../ui/jquery.ui.button.js"></script>

tests/unit/spinner/spinner_defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
commonWidgetTests( "spinner", {
22
defaults: {
3+
culture: null,
34
disabled: false,
45
incremental: true,
56
max: null,

tests/unit/spinner/spinner_options.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
module( "spinner: options" );
44

5+
// culture is tested after numberFormat, since it depends on numberFormat
6+
57
test( "incremental, false", function() {
68
expect( 100 );
79

@@ -91,6 +93,29 @@ test( "numberFormat, currency", function() {
9193
equal( element.val(), "$1.00", "formatted after step" );
9294
});
9395

96+
test( "culture, null", function() {
97+
expect( 2 );
98+
Globalize.culture( "ja-JP" );
99+
var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "C" });
100+
equal( element.val(), "¥0", "formatted on init" );
101+
element.spinner( "stepUp" );
102+
equal( element.val(), "¥1", "formatted after step" );
103+
104+
// reset culture
105+
Globalize.culture( "default" );
106+
});
107+
108+
test( "currency, ja-JP", function() {
109+
expect( 2 );
110+
var element = $( "#spin" ).val( 0 ).spinner({
111+
numberFormat: "C",
112+
culture: "ja-JP"
113+
});
114+
equal( element.val(), "¥0", "formatted on init" );
115+
element.spinner( "stepUp" );
116+
equal( element.val(), "¥1", "formatted after step" );
117+
});
118+
94119
test( "max", function() {
95120
expect( 3 );
96121
var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 });

tests/unit/tooltip/tooltip_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ commonWidgetTests( "tooltip", {
77
position: {
88
my: "left+15 center",
99
at: "right center",
10-
collision: "flip fit"
10+
collision: "flipfit flipfit"
1111
},
1212
show: true,
1313
tooltipClass: null,

themes/base/jquery.ui.progressbar.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
*
88
* http://docs.jquery.com/UI/Progressbar#theming
99
*/
10-
.ui-progressbar { height:2em; text-align: left; }
10+
.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
1111
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }

ui/jquery.effects.core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
161161
// prefix used for storing data on .data()
162162
dataSpace = "ec.storage.";
163163

164-
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function(_, prop) {
164+
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
165165
$.fx.step[ prop ] = function( fx ) {
166166
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
167167
jQuery.style( fx.elem, prop, fx.end );
@@ -171,8 +171,8 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
171171
});
172172

173173
function getElementStyles() {
174-
var style = document.defaultView
175-
? document.defaultView.getComputedStyle(this, null)
174+
var style = this.ownerDocument.defaultView
175+
? this.ownerDocument.defaultView.getComputedStyle( this, null )
176176
: this.currentStyle,
177177
newStyle = {},
178178
key,
@@ -223,7 +223,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
223223

224224
return this.queue( function() {
225225
var animated = $( this ),
226-
baseClass = animated.attr( "class" ),
226+
baseClass = animated.attr( "class" ) || "",
227227
finalClass,
228228
allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
229229

ui/jquery.ui.accordion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
*/
1414
(function( $, undefined ) {
1515

16-
var lastToggle = {};
17-
1816
// TODO: use ui-accordion-header-active class and fix styling
1917
$.widget( "ui.accordion", {
2018
version: "@VERSION",
@@ -39,6 +37,7 @@ $.widget( "ui.accordion", {
3937
var self = this,
4038
options = self.options;
4139

40+
self.lastToggle = {};
4241
self.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
4342

4443
self.headers = self.element.find( options.header )
@@ -378,10 +377,11 @@ $.widget( "ui.accordion", {
378377
}
379378

380379
animations[ animation ]({
380+
widget: self,
381381
toShow: toShow,
382382
toHide: toHide,
383-
prevShow: lastToggle.toShow,
384-
prevHide: lastToggle.toHide,
383+
prevShow: self.lastToggle.toShow,
384+
prevHide: self.lastToggle.toHide,
385385
complete: complete,
386386
down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) )
387387
}, additional );
@@ -450,7 +450,7 @@ $.extend( $.ui.accordion, {
450450
duration: 300
451451
}, options, additions );
452452

453-
lastToggle = options;
453+
options.widget.lastToggle = options;
454454

455455
if ( !options.toHide.size() ) {
456456
originalWidth = options.toShow[0].style.width;

ui/jquery.ui.autocomplete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ $.widget( "ui.autocomplete", {
328328
clearTimeout( self.searching );
329329
self.searching = setTimeout(function() {
330330
// only search if the value has changed
331-
if ( self.term != self.element.val() ) {
331+
if ( self.term != self._value() ) {
332332
self.selectedItem = null;
333333
self.search( null, event );
334334
}

ui/jquery.ui.menubar.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ $.widget( "ui.menubar", {
9494
}
9595
if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) {
9696
if( that.options.autoExpand ) {
97-
clearTimeout( that.timer );
97+
clearTimeout( that.closeTimer );
9898
}
9999

100100
that._open( event, menu );
@@ -123,22 +123,6 @@ $.widget( "ui.menubar", {
123123
.attr( "aria-haspopup", "true" )
124124
.wrapInner( "<span class='ui-button-text'></span>" );
125125

126-
if ( that.options.autoExpand ) {
127-
input.bind( "mouseleave.menubar", function( event ) {
128-
that.timer = setTimeout( function() {
129-
that._close();
130-
}, 150 );
131-
});
132-
menu.bind( "mouseleave.menubar", function( event ) {
133-
that.timer = setTimeout( function() {
134-
that._close();
135-
}, 150 );
136-
})
137-
.bind( "mouseenter.menubar", function( event ) {
138-
clearTimeout( that.timer );
139-
});
140-
}
141-
142126
// TODO review if these options are a good choice, maybe they can be merged
143127
if ( that.options.menuIcon ) {
144128
input.addClass( "ui-state-default" ).append( "<span class='ui-button-icon-secondary ui-icon ui-icon-triangle-1-s'></span>" );
@@ -166,7 +150,17 @@ $.widget( "ui.menubar", {
166150
focusout: function( event ) {
167151
that.closeTimer = setTimeout( function() {
168152
that._close( event );
169-
}, 100);
153+
}, 150);
154+
},
155+
"mouseleave .ui-menubar-item": function( event ) {
156+
if ( that.options.autoExpand ) {
157+
that.closeTimer = setTimeout( function() {
158+
that._close( event );
159+
}, 150);
160+
}
161+
},
162+
"mouseenter .ui-menubar-item": function( event ) {
163+
clearTimeout( that.closeTimer );
170164
}
171165
});
172166
},

ui/jquery.ui.sortable.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,11 @@ $.widget("ui.sortable", $.ui.mouse, {
6363

6464
destroy: function() {
6565
this.element
66-
.removeClass("ui-sortable ui-sortable-disabled")
67-
.removeData("sortable")
68-
.unbind(".sortable");
66+
.removeClass("ui-sortable ui-sortable-disabled");
6967
this._mouseDestroy();
7068

7169
for ( var i = this.items.length - 1; i >= 0; i-- )
72-
this.items[i].item.removeData("sortable-item");
70+
this.items[i].item.removeData(this.widgetName + "-item");
7371

7472
return this;
7573
},
@@ -86,6 +84,7 @@ $.widget("ui.sortable", $.ui.mouse, {
8684
},
8785

8886
_mouseCapture: function(event, overrideHandle) {
87+
var that = this;
8988

9089
if (this.reverting) {
9190
return false;
@@ -98,12 +97,12 @@ $.widget("ui.sortable", $.ui.mouse, {
9897

9998
//Find out if the clicked node (or one of its parents) is a actual item in this.items
10099
var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
101-
if($.data(this, 'sortable-item') == self) {
100+
if($.data(this, that.widgetName + '-item') == self) {
102101
currentItem = $(this);
103102
return false;
104103
}
105104
});
106-
if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
105+
if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
107106

108107
if(!currentItem) return false;
109108
if(this.options.handle && !overrideHandle) {
@@ -528,7 +527,7 @@ $.widget("ui.sortable", $.ui.mouse, {
528527
for (var i = connectWith.length - 1; i >= 0; i--){
529528
var cur = $(connectWith[i]);
530529
for (var j = cur.length - 1; j >= 0; j--){
531-
var inst = $.data(cur[j], 'sortable');
530+
var inst = $.data(cur[j], this.widgetName);
532531
if(inst && inst != this && !inst.options.disabled) {
533532
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
534533
}
@@ -550,7 +549,7 @@ $.widget("ui.sortable", $.ui.mouse, {
550549

551550
_removeCurrentsFromItems: function() {
552551

553-
var list = this.currentItem.find(":data(sortable-item)");
552+
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
554553

555554
for (var i=0; i < this.items.length; i++) {
556555

@@ -576,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
576575
for (var i = connectWith.length - 1; i >= 0; i--){
577576
var cur = $(connectWith[i]);
578577
for (var j = cur.length - 1; j >= 0; j--){
579-
var inst = $.data(cur[j], 'sortable');
578+
var inst = $.data(cur[j], this.widgetName);
580579
if(inst && inst != this && !inst.options.disabled) {
581580
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
582581
this.containers.push(inst);
@@ -592,7 +591,7 @@ $.widget("ui.sortable", $.ui.mouse, {
592591
for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
593592
var item = $(_queries[j]);
594593

595-
item.data('sortable-item', targetData); // Data for target checking (mouse manager)
594+
item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
596595

597596
items.push({
598597
item: item,

0 commit comments

Comments
 (0)