On Jan 24, 2006, at 1:05 PM, Beau Hartshorne wrote:
I'd like to ask for feedback on some possible new DOM functions to
help with element positioning:
MochiKit.DOM.Box, a new object: {t: 0, l: 0, b: 0, r: 0}
getContentBox(someElement), returns a Box
getBorderBox(someElement), returns a Box
getPaddingBox(someElement), returns a Box
getMarginBox(someElement), returns a Box
These will accept a partial box, like {r: 0} if you only want to
change one property:
setContentBox(someElement, aBox)
setBorderBox(someElement, aBox)
setPaddingBox(someElement, aBox)
setMarginBox(someElement, aBox)
getViewportDimensions(), returns a Dimensions object
moveTo(someElement, Coordinates/* optional */, aBoundingBox)
moveBy(someElement, Coordinates, Coordinates)
getStyleBox(someElement), returns a Box
setStyleBox(someElement, aBox)
setOpacity() // will accept 'none' to clear it
getOpacity()
All of these look good to me. Personally I would prefer an x,y,w,h
box model, but t,l,b,r is CSS convention so I guess that's more
appropriate.
isVisible(), returns true/false
toggleVisible(), uses hideElement and showElement
This is troublesome (as cited elsewhere in the thread). I'd rather
leave these out.
-bob