Hi,
I think elementDimensions() and setElementDimensions() in MochiKit.DOM
(1.3.1) handle padding inconsistently.
If I do the following to an element with total padding width/height of
pw/ph:
// As documented, dim.h = height + ph, and dim.w = width + pw
var dim = MochiKit.DOM.elementDimensions(elem);
// But setElementDimensions is expecting dim.h = height alone, and
dim.w = height alone
MochiKit.DOM.setElementDimensions(elem, dim);
// So this round trip has increased the (unpadded) dimensions of
the element by pw and ph!
var newdim = MochiKit.DOM.elementDimensions(elem);
then the element increases in size by its padding. Does this seem
right? It feels inconsistent to me. Given I'm using this function to
correct elements which might have had padding added by inline or
stylesheet CSS, how might I account for this? At the moment I'm
setting the dimensions twice:
/* ... */
M.DOM.setElementDimensions(elem, dim);
var wrongdim = M.DOM.elementDimensions(elem);
M.DOM.setElementDimensions(elem, {
w: dim.w - (wrongdim.w - dim.w),
h: dim.h - (wrongdim.h - dim.h)
});
But this introduces a display glitch that seems a little ugly -
elements get too big for their location on screen and wrap all over
the place (I'm covering it up with hide/showElement(), which isn't
ideal). Ironically, I only want to tweak the height - it's the
unintended extra width that's causing the problem!
Any thoughts?
J-P
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---