diff options
-rw-r--r-- | demos/autocomplete/categories.html | 4 | ||||
-rw-r--r-- | demos/autocomplete/combobox.html | 15 | ||||
-rw-r--r-- | demos/autocomplete/custom-data.html | 8 | ||||
-rw-r--r-- | demos/autocomplete/default.html | 2 | ||||
-rw-r--r-- | demos/autocomplete/folding.html | 2 | ||||
-rw-r--r-- | demos/autocomplete/maxheight.html | 4 | ||||
-rw-r--r-- | demos/autocomplete/multiple-remote.html | 6 | ||||
-rw-r--r-- | demos/autocomplete/multiple.html | 2 | ||||
-rw-r--r-- | demos/autocomplete/remote-jsonp.html | 10 | ||||
-rw-r--r-- | demos/autocomplete/remote-with-cache.html | 6 | ||||
-rw-r--r-- | demos/autocomplete/remote.html | 10 | ||||
-rw-r--r-- | demos/autocomplete/search.php | 2 | ||||
-rw-r--r-- | tests/jquery.simulate.js | 6 | ||||
-rw-r--r-- | tests/unit/button/button_tickets.js | 8 | ||||
-rw-r--r-- | ui/jquery.effects.scale.js | 31 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 14 | ||||
-rw-r--r-- | ui/jquery.ui.button.js | 17 | ||||
-rw-r--r-- | ui/jquery.ui.dialog.js | 16 | ||||
-rw-r--r-- | ui/jquery.ui.mouse.js | 2 | ||||
-rw-r--r-- | ui/jquery.ui.resizable.js | 34 |
20 files changed, 131 insertions, 68 deletions
diff --git a/demos/autocomplete/categories.html b/demos/autocomplete/categories.html index 17ec6495d..d2a1bc5bd 100644 --- a/demos/autocomplete/categories.html +++ b/demos/autocomplete/categories.html @@ -47,7 +47,7 @@ { label: "andreas andersson", category: "People" }, { label: "andreas johnson", category: "People" } ]; - + $( "#search" ).catcomplete({ delay: 0, source: data @@ -59,7 +59,7 @@ <div class="demo"> <label for="search">Search: </label> - <input id="search" /> + <input id="search"> </div><!-- End demo --> diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html index 5fb3ffef9..b228c1cbb 100644 --- a/demos/autocomplete/combobox.html +++ b/demos/autocomplete/combobox.html @@ -14,9 +14,16 @@ <script src="../../ui/jquery.ui.tooltip.js"></script> <link rel="stylesheet" href="../demos.css"> <style> - .ui-button { margin-left: -1px; } - .ui-button-icon-only .ui-button-text { padding: 0.35em; } - .ui-autocomplete-input { margin: 0; padding: 0.4em 0 0.4em 0.45em; } + .ui-button { + margin-left: -1px; + } + .ui-button-icon-only .ui-button-text { + padding: 0.35em; + } + .ui-autocomplete-input { + margin: 0; + padding: 0.4em 0 0.4em 0.45em; + } </style> <script> (function( $ ) { @@ -90,7 +97,7 @@ .addClass( "ui-widget ui-widget-content ui-corner-left" ); input.data( "autocomplete" )._renderItem = function( ul, item ) { - return $( "<li></li>" ) + return $( "<li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "</a>" ) .appendTo( ul ); diff --git a/demos/autocomplete/custom-data.html b/demos/autocomplete/custom-data.html index a4edc4fcc..a5782cab9 100644 --- a/demos/autocomplete/custom-data.html +++ b/demos/autocomplete/custom-data.html @@ -67,7 +67,7 @@ } }) .data( "autocomplete" )._renderItem = function( ul, item ) { - return $( "<li></li>" ) + return $( "<li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "<br>" + item.desc + "</a>" ) .appendTo( ul ); @@ -79,9 +79,9 @@ <div class="demo"> <div id="project-label">Select a project (type "j" for a start):</div> - <img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default"/> - <input id="project"/> - <input type="hidden" id="project-id"/> + <img id="project-icon" src="images/transparent_1x1.png" class="ui-state-default"> + <input id="project"> + <input type="hidden" id="project-id"> <p id="project-description"></p> </div><!-- End demo --> diff --git a/demos/autocomplete/default.html b/demos/autocomplete/default.html index 80e7642d4..bbd0889cf 100644 --- a/demos/autocomplete/default.html +++ b/demos/autocomplete/default.html @@ -49,7 +49,7 @@ <div class="ui-widget"> <label for="tags">Tags: </label> - <input id="tags" /> + <input id="tags"> </div> </div><!-- End demo --> diff --git a/demos/autocomplete/folding.html b/demos/autocomplete/folding.html index f3e45502b..8ebf0d0a6 100644 --- a/demos/autocomplete/folding.html +++ b/demos/autocomplete/folding.html @@ -46,7 +46,7 @@ <div class="ui-widget"> <form> <label for="developer">Developer: </label> - <input id="developer" /> + <input id="developer"> </form> </div> diff --git a/demos/autocomplete/maxheight.html b/demos/autocomplete/maxheight.html index c4f9769c3..f87f03171 100644 --- a/demos/autocomplete/maxheight.html +++ b/demos/autocomplete/maxheight.html @@ -60,12 +60,12 @@ </script> </head> <body> - + <div class="demo"> <div class="ui-widget"> <label for="tags">Tags: </label> - <input id="tags" /> + <input id="tags"> </div> </div><!-- End demo --> diff --git a/demos/autocomplete/multiple-remote.html b/demos/autocomplete/multiple-remote.html index 9351e8f3b..16472a36c 100644 --- a/demos/autocomplete/multiple-remote.html +++ b/demos/autocomplete/multiple-remote.html @@ -12,7 +12,9 @@ <script src="../../ui/jquery.ui.autocomplete.js"></script> <link rel="stylesheet" href="../demos.css"> <style> - .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } + .ui-autocomplete-loading { + background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; + } </style> <script> $(function() { @@ -69,7 +71,7 @@ <div class="ui-widget"> <label for="birds">Birds: </label> - <input id="birds" size="50" /> + <input id="birds" size="50"> </div> </div><!-- End demo --> diff --git a/demos/autocomplete/multiple.html b/demos/autocomplete/multiple.html index 4e67bf7e7..f5f249c41 100644 --- a/demos/autocomplete/multiple.html +++ b/demos/autocomplete/multiple.html @@ -84,7 +84,7 @@ <div class="ui-widget"> <label for="tags">Tag programming languages: </label> - <input id="tags" size="50" /> + <input id="tags" size="50"> </div> </div><!-- End demo --> diff --git a/demos/autocomplete/remote-jsonp.html b/demos/autocomplete/remote-jsonp.html index 1cc71d1e3..bfcbc0607 100644 --- a/demos/autocomplete/remote-jsonp.html +++ b/demos/autocomplete/remote-jsonp.html @@ -12,14 +12,16 @@ <script src="../../ui/jquery.ui.autocomplete.js"></script> <link rel="stylesheet" href="../demos.css"> <style> - .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } + .ui-autocomplete-loading { + background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; + } #city { width: 25em; } </style> <script> $(function() { function log( message ) { - $( "<div/>" ).text( message ).prependTo( "#log" ); - $( "#log" ).attr( "scrollTop", 0 ); + $( "<div>" ).text( message ).prependTo( "#log" ); + $( "#log" ).scrollTop( 0 ); } $( "#city" ).autocomplete({ @@ -65,7 +67,7 @@ <div class="ui-widget"> <label for="city">Your city: </label> - <input id="city" /> + <input id="city"> Powered by <a href="http://geonames.org">geonames.org</a> </div> diff --git a/demos/autocomplete/remote-with-cache.html b/demos/autocomplete/remote-with-cache.html index d7aabd72a..3d7a818ed 100644 --- a/demos/autocomplete/remote-with-cache.html +++ b/demos/autocomplete/remote-with-cache.html @@ -12,7 +12,9 @@ <script src="../../ui/jquery.ui.autocomplete.js"></script> <link rel="stylesheet" href="../demos.css"> <style> - .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } + .ui-autocomplete-loading { + background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; + } </style> <script> $(function() { @@ -44,7 +46,7 @@ <div class="ui-widget"> <label for="birds">Birds: </label> - <input id="birds" /> + <input id="birds"> </div> </div><!-- End demo --> diff --git a/demos/autocomplete/remote.html b/demos/autocomplete/remote.html index 5538b2822..3229c5cd8 100644 --- a/demos/autocomplete/remote.html +++ b/demos/autocomplete/remote.html @@ -12,13 +12,15 @@ <script src="../../ui/jquery.ui.autocomplete.js"></script> <link rel="stylesheet" href="../demos.css"> <style> - .ui-autocomplete-loading { background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; } + .ui-autocomplete-loading { + background: white url('images/ui-anim_basic_16x16.gif') right center no-repeat; + } </style> <script> $(function() { function log( message ) { - $( "<div/>" ).text( message ).prependTo( "#log" ); - $( "#log" ).attr( "scrollTop", 0 ); + $( "<div>" ).text( message ).prependTo( "#log" ); + $( "#log" ).scrollTop( 0 ); } $( "#birds" ).autocomplete({ @@ -39,7 +41,7 @@ <div class="ui-widget"> <label for="birds">Birds: </label> - <input id="birds" /> + <input id="birds"> </div> <div class="ui-widget" style="margin-top:2em; font-family:Arial"> diff --git a/demos/autocomplete/search.php b/demos/autocomplete/search.php index cbe78a52a..835772dee 100644 --- a/demos/autocomplete/search.php +++ b/demos/autocomplete/search.php @@ -1,4 +1,6 @@ <?php + +sleep( 3 ); // no term passed - just exit early with no response if (empty($_GET['term'])) exit ; $q = strtolower($_GET["term"]); diff --git a/tests/jquery.simulate.js b/tests/jquery.simulate.js index a88b6cbe4..bb82624d3 100644 --- a/tests/jquery.simulate.js +++ b/tests/jquery.simulate.js @@ -123,10 +123,10 @@ $.extend($.simulate.prototype, { this.simulateEvent(target, "click", coord); }, findCenter: function(el) { - var el = $(this.target), o = el.offset(); + var el = $(this.target), o = el.offset(), d = $(document); return { - x: o.left + el.outerWidth() / 2, - y: o.top + el.outerHeight() / 2 + x: o.left + el.outerWidth() / 2 - d.scrollLeft(), + y: o.top + el.outerHeight() / 2 - d.scrollTop() }; } }); diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js index 79bbfeb5c..9a7ccae43 100644 --- a/tests/unit/button/button_tickets.js +++ b/tests/unit/button/button_tickets.js @@ -20,6 +20,14 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) ); }); +test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { + var check = $( "#check" ).button(), + label = $( "label[for='check']" ); + ok( !label.is( ".ui-state-focus" ) ); + check.focus(); + ok( label.is( ".ui-state-focus" ) ); +}); + test( "#7092 - button creation that requires a matching label does not find label in all cases", function() { var group = $( "<span><label for='t7092a'/><input type='checkbox' id='t7092a'/></span>" ); group.find( "input:checkbox" ).button(); diff --git a/ui/jquery.effects.scale.js b/ui/jquery.effects.scale.js index b5c49ce7c..00f0151af 100644 --- a/ui/jquery.effects.scale.js +++ b/ui/jquery.effects.scale.js @@ -54,7 +54,9 @@ $.effects.effect.scale = function( o ) { origin = o.origin, original = { height: el.height(), - width: el.width() + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() }, factor = { y: direction != 'horizontal' ? (percent / 100) : 1, @@ -74,7 +76,9 @@ $.effects.effect.scale = function( o ) { options.from = o.from || ( mode == 'show' ? { height: 0, width: 0 } : original ); options.to = { height: original.height * factor.y, - width: original.width * factor.x + width: original.width * factor.x, + outerHeight: original.outerHeight * factor.y, + outerWidth: original.outerWidth * factor.x }; if ( options.fade ) { // Fade option to support puff @@ -122,21 +126,14 @@ $.effects.effect.size = function( o ) { } original = { height: el.height(), - width: el.width() + width: el.width(), + outerHeight: el.outerHeight(), + outerWidth: el.outerWidth() }; el.from = o.from || original; el.to = o.to || original; - // Adjust - if (origin) { // Calculate baseline shifts - baseline = $.effects.getBaseline( origin, original ); - el.from.top = ( original.height - el.from.height ) * baseline.y; - el.from.left = ( original.width - el.from.width ) * baseline.x; - el.to.top = ( original.height - el.to.height ) * baseline.y; - el.to.left = ( original.width - el.to.width ) * baseline.x; - } - // Set scaling factor factor = { from: { @@ -183,6 +180,16 @@ $.effects.effect.size = function( o ) { $.effects.createWrapper( el ); el.css( 'overflow', 'hidden' ).css( el.from ); + // Adjust + if (origin) { // Calculate baseline shifts + baseline = $.effects.getBaseline( origin, original ); + el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; + el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; + el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; + el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; + } + el.css( el.from ); // set top & left + // Animate if ( scale == 'content' || scale == 'both' ) { // Scale the children diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index f6573174a..4619949fb 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -63,7 +63,7 @@ $.widget( "ui.autocomplete", { }) .bind( "keydown.autocomplete", function( event ) { if ( self.options.disabled || self.element.attr( "readonly" ) ) { - suppressKeyPress = true; + suppressKeyPress = true; suppressInput = true; return; } @@ -73,21 +73,21 @@ $.widget( "ui.autocomplete", { var keyCode = $.ui.keyCode; switch( event.keyCode ) { case keyCode.PAGE_UP: - suppressKeyPress = true; + suppressKeyPress = true; self._move( "previousPage", event ); break; case keyCode.PAGE_DOWN: - suppressKeyPress = true; + suppressKeyPress = true; self._move( "nextPage", event ); break; case keyCode.UP: - suppressKeyPress = true; + 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; + suppressKeyPress = true; self._move( "next", event ); // prevent moving cursor to end of text field in some browsers event.preventDefault(); @@ -122,7 +122,7 @@ $.widget( "ui.autocomplete", { if ( suppressKeyPress ) { suppressKeyPress = false; event.preventDefault(); - return; + return; } // replicate some key handlers to allow them to repeat in Firefox and Opera @@ -144,7 +144,7 @@ $.widget( "ui.autocomplete", { // prevent moving cursor to end of text field in some browsers event.preventDefault(); break; - } + } }) .bind( "input.autocomplete", function(event) { if ( suppressInput ) { diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index a95dddc6c..32e00e9e0 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -95,19 +95,22 @@ $.widget( "ui.button", { } $( this ).removeClass( hoverClass ); }) - .bind( "focus.button", function() { - // no need to check disabled, focus won't be triggered anyway - $( this ).addClass( focusClass ); - }) - .bind( "blur.button", function() { - $( this ).removeClass( focusClass ); - }) .bind( "click.button", function( event ) { if ( options.disabled ) { + event.preventDefault(); event.stopImmediatePropagation(); } }); + this.element + .bind( "focus.button", function() { + // no need to check disabled, focus won't be triggered anyway + self.buttonElement.addClass( focusClass ); + }) + .bind( "blur.button", function() { + self.buttonElement.removeClass( focusClass ); + }); + if ( toggleButton ) { this.element.bind( "change.button", function() { if ( clickDragged ) { diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index dc2849155..84b2dd3b3 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -190,6 +190,10 @@ $.widget("ui.dialog", { }, close: function( event ) { + if ( !this._isOpen ) { + return self; + } + var self = this, maxZ, thisZ; @@ -197,13 +201,13 @@ $.widget("ui.dialog", { return; } + self._isOpen = false; + if ( self.overlay ) { self.overlay.destroy(); } self.uiDialog.unbind( "keypress.ui-dialog" ); - self._isOpen = false; - if ( self.options.hide ) { self.uiDialog.hide( self.options.hide, function() { self._trigger( "close", event ); @@ -369,8 +373,7 @@ $.widget("ui.dialog", { _makeDraggable: function() { var self = this, options = self.options, - doc = $( document ), - heightBeforeDrag; + doc = $( document ); function filteredUi( ui ) { return { @@ -384,9 +387,7 @@ $.widget("ui.dialog", { handle: ".ui-dialog-titlebar", containment: "document", start: function( event, ui ) { - heightBeforeDrag = options.height === "auto" ? "auto" : $( this ).height(); $( this ) - .height( $( this ).height() ) .addClass( "ui-dialog-dragging" ); self._trigger( "dragStart", event, filteredUi( ui ) ); }, @@ -399,8 +400,7 @@ $.widget("ui.dialog", { ui.position.top - doc.scrollTop() ]; $( this ) - .removeClass( "ui-dialog-dragging" ) - .height( heightBeforeDrag ); + .removeClass( "ui-dialog-dragging" ); self._trigger( "dragStop", event, filteredUi( ui ) ); $.ui.dialog.overlay.resize(); } diff --git a/ui/jquery.ui.mouse.js b/ui/jquery.ui.mouse.js index 0bd38db85..2fb1389f2 100644 --- a/ui/jquery.ui.mouse.js +++ b/ui/jquery.ui.mouse.js @@ -58,7 +58,7 @@ $.widget("ui.mouse", { var self = this, btnIsLeft = (event.which == 1), - elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); + elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).closest(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } diff --git a/ui/jquery.ui.resizable.js b/ui/jquery.ui.resizable.js index e0579ef84..de24e94dd 100644 --- a/ui/jquery.ui.resizable.js +++ b/ui/jquery.ui.resizable.js @@ -293,6 +293,8 @@ $.widget("ui.resizable", $.ui.mouse, { // Calculate the attrs that will be change var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff; + // Put this in the mouseDrag handler since the user can start pressing shift while resizing + this._updateVirtualBoundaries(event.shiftKey); if (this._aspectRatio || event.shiftKey) data = this._updateRatio(data, event); @@ -351,6 +353,32 @@ $.widget("ui.resizable", $.ui.mouse, { }, + _updateVirtualBoundaries: function(forceAspectRatio) { + var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; + + b = { + minWidth: isNumber(o.minWidth) ? o.minWidth : 0, + maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity, + minHeight: isNumber(o.minHeight) ? o.minHeight : 0, + maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity + }; + + if(this._aspectRatio || forceAspectRatio) { + // We want to create an enclosing box whose aspect ration is the requested one + // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension + pMinWidth = b.minHeight * this.aspectRatio; + pMinHeight = b.minWidth / this.aspectRatio; + pMaxWidth = b.maxHeight * this.aspectRatio; + pMaxHeight = b.maxWidth / this.aspectRatio; + + if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; + if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; + if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; + if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; + } + this._vBoundaries = b; + }, + _updateCache: function(data) { var o = this.options; this.offset = this.helper.offset(); @@ -364,8 +392,8 @@ $.widget("ui.resizable", $.ui.mouse, { var o = this.options, cpos = this.position, csize = this.size, a = this.axis; - if (data.height) data.width = (csize.height * this.aspectRatio); - else if (data.width) data.height = (csize.width / this.aspectRatio); + if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); + else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); if (a == 'sw') { data.left = cpos.left + (csize.width - data.width); @@ -381,7 +409,7 @@ $.widget("ui.resizable", $.ui.mouse, { _respectSize: function(data, event) { - var el = this.helper, o = this.options, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, + var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis, ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); |