Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

Better detection for dimension('children')


Project:Flexify
Version:1.0.0-uncompressed
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Storing this here for future reference.

It may be possible to use float shrink-wrapping as a tool for determining the size of its content. For example:

function getChildrenSize(elem, axis, prefix, isContainer) {
// containers are special cases
if (isContainer)
return document.documentElement['client' + Prop[axis]];

//[FIX] clientHeight doesn't work here in IE; fortunately, scrollHeight is always correct
if ($.browser.msie && axis == 'vertical')
return elem.scrollHeight;

// shrink-wrap element
var prop = Prop[axis].toLowerCase();
var origFloat = elem.style.cssFloat;
var origDimension = elem.style[prop];
elem.style.cssFloat = 'left';
elem.style[prop] = 'auto';
var size = elem['client' + Prop[axis]];
elem.style.cssFloat = origFloat;
elem.style[prop] = origDimension;
return size;
}

This uses the float algorithm to find minimum size. While it would be more accurate, in theory, than using offsets, it's slow and rather error-prone.

An ideal solution would be a scrollHeight/Width which always matched its content (IE does this for scrollHeight) but alas, I haven't found it yet.