wetfish / basic

A tiny, customizable JavaScript UI framework.
MIT License
9 stars 3 forks source link

Position should be determined using .getBoundingClientRect() #1

Closed itsrachelfish closed 9 years ago

itsrachelfish commented 9 years ago

Certain browsers return different results for top / left style properties generated by .getComputedStyle(). For example if you have an element without any specific position defined, $(element).style('top') will return the actual value ('8px') in Firefox, but ('auto') in Chrome.

Basic should have a .position() function to abstract this and .size() should probably be updated to use .getBoundingClientRect() as well.

itsrachelfish commented 9 years ago

After some testing, it turns out that .getBoundingClientRect() doesn't detect size as nicely as I'd hoped. (See issue #14 for more information) But it should still be used for determining the position of elements on the page.