Skip to content
Permalink
Browse files

Core: Added $.support.minHeight. Fixes #6026 - Core: Add jQuery.suppo…

…rt.minHeight.
  • Loading branch information...
scottgonzalez committed Sep 7, 2010
1 parent d80e223 commit 99694e6fec88c0fbb10144f856073f01cd44091f
Showing with 15 additions and 2 deletions.
  1. +15 −2 ui/jquery.ui.core.js
@@ -56,7 +56,7 @@ $.extend( $.ui, {
}
});

//jQuery plugins
// plugins
$.fn.extend({
_focus: $.fn.focus,
focus: function( delay, fn ) {
@@ -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" ||
@@ -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: {

0 comments on commit 99694e6

Please sign in to comment.
You can’t perform that action at this time.