Opened 15 years ago

Closed 15 years ago

#3090 closed bug (duplicate)

when margins are set to auto in IE, height and width fail to calculate throwing an NaN

Reported by: [email protected] Owned by: Scott González
Priority: major Milestone:
Component: ui.dialog Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:


when the dialog is created and/or resized, the width and height of certain divs in the dialog are set explicitly. the width/height are calculated, compensating for the margins.

when the margins are retrieved, and if they are set to "auto", when parseint is called, it returns a "NaN". when it then tries to do the math... it ends up with a value that looks like this: "NaNpx" which jquery won't accept when it tries to set the style attribute, which means the height/width doesn't get set.

... if i test for this and set those margins to 0 if they aren't a number then i get weird results

code: size: function() {

var container = this.uiDialogContainer,

titlebar = this.uiDialogTitlebar, content = this.element, tbMargin = parseInt(content.css('margin-top')) + parseInt(content.css('margin-bottom')), lrMargin = parseInt(content.css('margin-left')) + parseInt(content.css('margin-right'));

if (isNaN(tbMargin)) {tbMargin = 0;} if (isNaN(lrMargin)) {lrMargin = 0;}

content.height(container.height() - titlebar.outerHeight() - tbMargin); content.width(container.width() - lrMargin);


This only fails on IE 6 (the only place i've encountered the problem.)

Change History (1)

comment:1 Changed 15 years ago by Scott González

Resolution: duplicate
Status: newclosed

Duplicate of #3086.

Note: See TracTickets for help on using tickets.