#1092 new
Jan Schneider

Fix width calculation in 1.7 from git

Reported by Jan Schneider | July 7th, 2010 @ 12:26 PM

I just noticed that the old code of getDimensions() has been restored for BC reasons. This fixed my original problems, but I was able to fix some misbehavior in Layout.get('width'), specifically in _begin() without that change. The problem showed up with a element layout like this:

<script src="js/prototype.js"></script>
<div id="outer" style="position:relative;top:200px">
  <div id="inner" style="display:none;position:absolute;width:auto;background-color:green">
    foo<br />
    bar
  </div>
</div>
<script>
document.write($('inner').getLayout().get('width') + '<br />');
$('inner').show();
document.write($('inner').getLayout().get('width') + '<br />');
</script>

Before the show() call, the width is calculated as the parent element's with.
Attached is a proposed patch to fix this. I was only able to test on Firefox and Opera so far, but it even fixed another unit test in Opera that failed before that patch.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

Tags

Pages