lewisje / ourlibrary

Automatically exported from code.google.com/p/ourlibrary
0 stars 0 forks source link

getElementSizeStyle leaves inline styles on elements #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
getElementSizeStyle leaves height and width inline styles on elements, which 
overrides the default for both styles in elements (auto).

Here's the suggested patched getElementSizeStyles
getElementSizeStyle = function(el) {
  var dim = [];
  var tmpDim = [];

  dim[0] = getStylePixels(el, 'height');
  dim[1] = getStylePixels(el, 'width');
  if ((dim[0] === null || dim[1] === null || computedSizeBad)) {
    if (typeof el.offsetHeight == 'number') {
      dim[0] = el.offsetHeight;
      dim[1] = el.offsetWidth;
      tmpDim[0] = el.style.height;
      tmpDim[1] = el.style.width;
      el.style.height = dim[0] + 'px';
      el.style.width = dim[1] + 'px';
      adjustElementSize(el, dim);
      el.style.height = tmpDim[0];
      el.style.width = tmpDim[1];
    }
    else {
      return null;
    }
  }
  return dim;
}; 

Original issue reported on code.google.com by gabrielg...@gmail.com on 31 Jul 2010 at 5:41

GoogleCodeExporter commented 9 years ago
Yes, I noticed that side effect when I put together the size primer:-

http://www.cinsoft.net/size.html

I'm planning on porting that code for the 1.0 version.

Thanks Gabe!

Original comment by dmark.ci...@gmail.com on 3 Aug 2010 at 1:31