tysonmatanich/elementQuery — pull request #4 by pastudan (2013-08-08 23:25:19+00:00)
Title: Rudimentary support for percentage (%) units

I am creating a widget which changes the color of a progress bar depending on it's percentage completion, and need to use this in multiple locations, so I updated the code to support percent widths and heights.

Unfortunately, I have to calculate the percent values from the element and it's parent's height or width, and I can not seem to get them to consistently come out exactly to what they are set to for the element, even if I round up / down.

I have tried using clientWidth and offsetWidth, but these only seem to return integer values. Perhaps someone knows of a better way to calculate percentage of an element?