Skip to content

Commit

Permalink
Core: Added $.support.minHeight. Fixes #6026 - Core: Add jQuery.suppo…
Browse files Browse the repository at this point in the history
…rt.minHeight.
  • Loading branch information
scottgonzalez committed Sep 7, 2010
1 parent d80e223 commit 99694e6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ui/jquery.ui.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $.extend( $.ui, {
}
});

//jQuery plugins
// plugins
$.fn.extend({
_focus: $.fn.focus,
focus: function( delay, fn ) {
Expand Down Expand Up @@ -174,7 +174,7 @@ $.each( [ "Width", "Height" ], function( i, name ) {
};
});

//Additional selectors
// selectors
function visible( element ) {
return !$( element ).parents().andSelf().filter(function() {
return $.curCSS( this, "visibility" ) === "hidden" ||
Expand Down Expand Up @@ -215,10 +215,23 @@ $.extend( $.expr[ ":" ], {
}
});

// support
$(function() {
var div = document.createElement( "div" );
div.style.minHeight = "100px";

document.body.appendChild( div );
$.support.minHeight = div.offsetHeight === 100;
document.body.removeChild( div ).style.display = "none";

This comment has been minimized.

Copy link
@jdalton

jdalton Sep 7, 2010

Member

Why hide div when it is already removed and about to be nulled ?

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Sep 7, 2010

Author Member

I honestly don't know. This code is adapted from jQuery core: http://github.com/jquery/jquery/blob/master/src/support.js#L104-112

I had the same question, but nobody was around for me to ping when I was implementing this :-P

This comment has been minimized.

Copy link
@jdalton

jdalton Sep 7, 2010

Member

cool. It can be reduced...

 var div = document.createElement( "div" ), body = document.body;
 div.style.minHeight = "100px";

 $.support.minHeight = body.appendChild(div).offsetHeight >= 100;
 body.removeChild(div);

 // div = null; < - not really needed either just there for dev superstition

This comment has been minimized.

Copy link
@jdalton

jdalton Sep 7, 2010

Member

Though even .offsetHeight >= 100; might give a false positive a style sheet sets DIVs height to above 100px.

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Sep 7, 2010

Author Member

We could set height, padding, and border as well to ensure it's "safe" from other declared styles.

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Sep 7, 2010

Author Member

Fixed in 409f5d1


div = null;
});





// deprecated
$.extend( $.ui, {
// $.ui.plugin is deprecated. Use the proxy pattern instead.
plugin: {
Expand Down

0 comments on commit 99694e6

Please sign in to comment.