[ 3 posts ]

Marc

YUI Contributor

  • Offline
  • Profile

Changes to the way offsetWidth is calculated 3.5.0pr4?

Post Posted: Sat Mar 24, 2012 6:26 am
+0-
Hi,

I'm having some issues with a component that uses offsetWidth. In some cases with 3.5.0pr4 the offsetWidth doesn't seem to be updated. I haven't been able to pinpoint when it happens, but when I do something like this

Code:
<span class="yui3-slidecheckbox-labelOn"><label><span>YES</span></label></span>

var leftX = this._labelOnNode.one('span').get('offsetWidth');//19
var width = this._labelOnNode.get('offsetWidth');//19
this._labelOnNode.one('span').setStyle('width',33);
width = this._labelOnNode.get('offsetWidth');//still 19



It seem labelOnNode offsetWidth doesn't get updated.

I can reliably reproduce this in our production environment, but with the component page for gallery-slidecheckbox it works correctly. I'm just wondering if anything changed to the way offsetWidth is used or updated. Up to and including 3.5.0pr2, this worked normally.

Cheers,
Marc

Matt Sweeney

YUI Developer

  • YUI Developer
  • Offline
  • Profile
Tags:

Re: Changes to the way offsetWidth is calculated 3.5.0pr4?

Post Posted: Sat Mar 24, 2012 3:48 pm
+0-
This is expected behavior. Styling the width of an inline element has no effect. Set the SPAN to display:block and the width will be respected.

Marc

YUI Contributor

  • Offline
  • Profile

Re: Changes to the way offsetWidth is calculated 3.5.0pr4?

Post Posted: Wed Mar 28, 2012 9:56 am
+0-
Ok, I made some changes to the component, hopefully this will resolve the issue. It does remain a little unsettling that in 3.5.0pr4 it suddenly doesn't work as before.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum