Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:jquery/jquery-ui into selectmenu

  • Loading branch information...
commit ac54556fb3b7ab08744cc7ea663a276d5c91cdd4 2 parents d7e23ce + 647bab5
@fnagel fnagel authored
View
1  demos/popup/index.html
@@ -10,6 +10,7 @@
<h4>Examples</h4>
<ul>
<li class="demo-config-on"><a href="default.html">Default functionality</a></li>
+ <li><a href="tooltip.html">Popup on hover (tooltip)</a></li>
<li><a href="animation.html">Popup - show/hide effects</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>
View
66 demos/popup/tooltip.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>jQuery UI Popup - Tooltip style 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.6.2.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.popup.js"></script>
+ <script>
+ $(function() {
+ $("#more-info").popup({
+ position: {
+ of: "#info-link"
+ }
+ });
+
+ $( "#info-link" ).hover(
+ function( event ) {
+ $("#more-info").popup( "open" );
+ },
+ function( event ) {
+ $("#more-info").popup( "close" );
+ }
+ );
+ });
+ </script>
+ <style type="text/css">
+ .ui-icon {
+ display: inline-block;
+ }
+ #more-info {
+ width: 11em;
+ 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;
+ position: absolute;
+ z-index: 5000;
+ display: none;
+ }
+ </style>
+</head>
+<body>
+
+<div class="demo">
+ <div>
+ <textarea>More info about me to the right -></textarea> <span id="info-link" class="ui-icon ui-icon-info" />
+ </div>
+ <div id="more-info">This is some more info</div>
+</div>
+
+<div class="demo-description">
+
+<p>A "more info" popup that works on mouseover (tooltip).</p>
+
+</div><!-- End demo-description -->
+
+
+</body>
+</html>
View
14 demos/tooltip/tracking.html
@@ -19,14 +19,16 @@
<script>
$(function() {
$( ".demo" ).tooltip({
+ position: {
+ my: "left+25 center",
+ at: "center"
+ },
open: function( event ) {
- var tooltip = $( ".ui-tooltip" );
+ var tooltip = $( ".ui-tooltip" ),
+ positionOption = $( this ).tooltip( "option", "position" );
function position( event ) {
- tooltip.position({
- my: "left+25 center",
- at: "right+25 center",
- of: event
- });
+ positionOption.of = event;
+ tooltip.position( positionOption );
}
$( document ).bind( "mousemove.tooltip-position", position );
// trigger once to override element-relative positioning
View
4 tests/unit/effects/effects_core.js
@@ -143,10 +143,10 @@ asyncTest( "animateClass clears style properties when stopped", function() {
expect( 2 );
test.addClass( "testChangeBackground", duration );
- notEqual( orig, style.cssText, "cssText is the not the same after starting animation" );
+ notEqual( orig, style.cssText, "cssText is not the same after starting animation" );
test.stop( true, true );
- equal( orig, style.cssText, "cssText is the same after stopping animation midway" );
+ equal( orig, $.trim( style.cssText ), "cssText is the same after stopping animation midway" );
start();
});
View
1  tests/unit/spinner/spinner.html
@@ -9,6 +9,7 @@
<script src="../../jquery.js"></script>
<script src="../../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../../external/globalize.js"></script>
+ <script src="../../../external/globalize.culture.ja-JP.js"></script>
<script src="../../../ui/jquery.ui.core.js"></script>
<script src="../../../ui/jquery.ui.widget.js"></script>
<script src="../../../ui/jquery.ui.button.js"></script>
View
1  tests/unit/spinner/spinner_defaults.js
@@ -1,5 +1,6 @@
commonWidgetTests( "spinner", {
defaults: {
+ culture: null,
disabled: false,
incremental: true,
max: null,
View
25 tests/unit/spinner/spinner_options.js
@@ -2,6 +2,8 @@
module( "spinner: options" );
+// culture is tested after numberFormat, since it depends on numberFormat
+
test( "incremental, false", function() {
expect( 100 );
@@ -91,6 +93,29 @@ test( "numberFormat, currency", function() {
equal( element.val(), "$1.00", "formatted after step" );
});
+test( "culture, null", function() {
+ expect( 2 );
+ Globalize.culture( "ja-JP" );
+ var element = $( "#spin" ).val( 0 ).spinner({ numberFormat: "C" });
+ equal( element.val(), "¥0", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "¥1", "formatted after step" );
+
+ // reset culture
+ Globalize.culture( "default" );
+});
+
+test( "currency, ja-JP", function() {
+ expect( 2 );
+ var element = $( "#spin" ).val( 0 ).spinner({
+ numberFormat: "C",
+ culture: "ja-JP"
+ });
+ equal( element.val(), "¥0", "formatted on init" );
+ element.spinner( "stepUp" );
+ equal( element.val(), "¥1", "formatted after step" );
+});
+
test( "max", function() {
expect( 3 );
var element = $( "#spin" ).val( 1000 ).spinner({ max: 100 });
View
2  tests/unit/tooltip/tooltip_defaults.js
@@ -7,7 +7,7 @@ commonWidgetTests( "tooltip", {
position: {
my: "left+15 center",
at: "right center",
- collision: "flip fit"
+ collision: "flipfit flipfit"
},
show: true,
tooltipClass: null,
View
2  themes/base/jquery.ui.progressbar.css
@@ -7,5 +7,5 @@
*
* http://docs.jquery.com/UI/Progressbar#theming
*/
-.ui-progressbar { height:2em; text-align: left; }
+.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
View
8 ui/jquery.effects.core.js
@@ -161,7 +161,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
// prefix used for storing data on .data()
dataSpace = "ec.storage.";
-$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function(_, prop) {
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
$.fx.step[ prop ] = function( fx ) {
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
jQuery.style( fx.elem, prop, fx.end );
@@ -171,8 +171,8 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
});
function getElementStyles() {
- var style = document.defaultView
- ? document.defaultView.getComputedStyle(this, null)
+ var style = this.ownerDocument.defaultView
+ ? this.ownerDocument.defaultView.getComputedStyle( this, null )
: this.currentStyle,
newStyle = {},
key,
@@ -223,7 +223,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
return this.queue( function() {
var animated = $( this ),
- baseClass = animated.attr( "class" ),
+ baseClass = animated.attr( "class" ) || "",
finalClass,
allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
View
10 ui/jquery.ui.accordion.js
@@ -13,8 +13,6 @@
*/
(function( $, undefined ) {
-var lastToggle = {};
-
// TODO: use ui-accordion-header-active class and fix styling
$.widget( "ui.accordion", {
version: "@VERSION",
@@ -39,6 +37,7 @@ $.widget( "ui.accordion", {
var self = this,
options = self.options;
+ self.lastToggle = {};
self.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
self.headers = self.element.find( options.header )
@@ -378,10 +377,11 @@ $.widget( "ui.accordion", {
}
animations[ animation ]({
+ widget: self,
toShow: toShow,
toHide: toHide,
- prevShow: lastToggle.toShow,
- prevHide: lastToggle.toHide,
+ prevShow: self.lastToggle.toShow,
+ prevHide: self.lastToggle.toHide,
complete: complete,
down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) )
}, additional );
@@ -450,7 +450,7 @@ $.extend( $.ui.accordion, {
duration: 300
}, options, additions );
- lastToggle = options;
+ options.widget.lastToggle = options;
if ( !options.toHide.size() ) {
originalWidth = options.toShow[0].style.width;
View
2  ui/jquery.ui.autocomplete.js
@@ -328,7 +328,7 @@ $.widget( "ui.autocomplete", {
clearTimeout( self.searching );
self.searching = setTimeout(function() {
// only search if the value has changed
- if ( self.term != self.element.val() ) {
+ if ( self.term != self._value() ) {
self.selectedItem = null;
self.search( null, event );
}
View
30 ui/jquery.ui.menubar.js
@@ -94,7 +94,7 @@ $.widget( "ui.menubar", {
}
if ( ( that.open && event.type == "mouseenter" ) || event.type == "click" || that.options.autoExpand ) {
if( that.options.autoExpand ) {
- clearTimeout( that.timer );
+ clearTimeout( that.closeTimer );
}
that._open( event, menu );
@@ -123,22 +123,6 @@ $.widget( "ui.menubar", {
.attr( "aria-haspopup", "true" )
.wrapInner( "<span class='ui-button-text'></span>" );
- if ( that.options.autoExpand ) {
- input.bind( "mouseleave.menubar", function( event ) {
- that.timer = setTimeout( function() {
- that._close();
- }, 150 );
- });
- menu.bind( "mouseleave.menubar", function( event ) {
- that.timer = setTimeout( function() {
- that._close();
- }, 150 );
- })
- .bind( "mouseenter.menubar", function( event ) {
- clearTimeout( that.timer );
- });
- }
-
// 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>" );
@@ -166,7 +150,17 @@ $.widget( "ui.menubar", {
focusout: function( event ) {
that.closeTimer = setTimeout( function() {
that._close( event );
- }, 100);
+ }, 150);
+ },
+ "mouseleave .ui-menubar-item": function( event ) {
+ if ( that.options.autoExpand ) {
+ that.closeTimer = setTimeout( function() {
+ that._close( event );
+ }, 150);
+ }
+ },
+ "mouseenter .ui-menubar-item": function( event ) {
+ clearTimeout( that.closeTimer );
}
});
},
View
19 ui/jquery.ui.sortable.js
@@ -63,13 +63,11 @@ $.widget("ui.sortable", $.ui.mouse, {
destroy: function() {
this.element
- .removeClass("ui-sortable ui-sortable-disabled")
- .removeData("sortable")
- .unbind(".sortable");
+ .removeClass("ui-sortable ui-sortable-disabled");
this._mouseDestroy();
for ( var i = this.items.length - 1; i >= 0; i-- )
- this.items[i].item.removeData("sortable-item");
+ this.items[i].item.removeData(this.widgetName + "-item");
return this;
},
@@ -86,6 +84,7 @@ $.widget("ui.sortable", $.ui.mouse, {
},
_mouseCapture: function(event, overrideHandle) {
+ var that = this;
if (this.reverting) {
return false;
@@ -98,12 +97,12 @@ $.widget("ui.sortable", $.ui.mouse, {
//Find out if the clicked node (or one of its parents) is a actual item in this.items
var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
- if($.data(this, 'sortable-item') == self) {
+ if($.data(this, that.widgetName + '-item') == self) {
currentItem = $(this);
return false;
}
});
- if($.data(event.target, 'sortable-item') == self) currentItem = $(event.target);
+ if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
if(!currentItem) return false;
if(this.options.handle && !overrideHandle) {
@@ -528,7 +527,7 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
- var inst = $.data(cur[j], 'sortable');
+ var inst = $.data(cur[j], this.widgetName);
if(inst && inst != this && !inst.options.disabled) {
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]);
}
@@ -550,7 +549,7 @@ $.widget("ui.sortable", $.ui.mouse, {
_removeCurrentsFromItems: function() {
- var list = this.currentItem.find(":data(sortable-item)");
+ var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
for (var i=0; i < this.items.length; i++) {
@@ -576,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var i = connectWith.length - 1; i >= 0; i--){
var cur = $(connectWith[i]);
for (var j = cur.length - 1; j >= 0; j--){
- var inst = $.data(cur[j], 'sortable');
+ var inst = $.data(cur[j], this.widgetName);
if(inst && inst != this && !inst.options.disabled) {
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
this.containers.push(inst);
@@ -592,7 +591,7 @@ $.widget("ui.sortable", $.ui.mouse, {
for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
var item = $(_queries[j]);
- item.data('sortable-item', targetData); // Data for target checking (mouse manager)
+ item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
items.push({
item: item,
View
6 ui/jquery.ui.spinner.js
@@ -30,6 +30,7 @@ $.widget( "ui.spinner", {
defaultElement: "<input>",
widgetEventPrefix: "spin",
options: {
+ culture: null,
incremental: true,
max: null,
min: null,
@@ -320,7 +321,8 @@ $.widget( "ui.spinner", {
_parse: function( val ) {
if ( typeof val === "string" && val !== "" ) {
- val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val ) : +val;
+ val = window.Globalize && this.options.numberFormat ?
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
}
return val === "" || isNaN( val ) ? null : val;
},
@@ -330,7 +332,7 @@ $.widget( "ui.spinner", {
return "";
}
return window.Globalize && this.options.numberFormat ?
- Globalize.format( value, this.options.numberFormat ) :
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
value;
},
Please sign in to comment.
Something went wrong with that request. Please try again.