thatcher / env-js

A pure-JavaScript browser environment.
http://www.envjs.com/
464 stars 75 forks source link

It fails to read offsetWidth and offsetHeight when widht/height of element is set in percentage #28

Open aichi opened 13 years ago

aichi commented 13 years ago

When widht/height of element is set in percentage like 100% then enviroment methods offsetWidth and offsetHeight return NaN. We quick fix it like:

get offsetHeight(){ return Math.ceil(parseInt(this.style.height) || 1); }, get offsetWidth(){ return Math.ceil(parseInt(this.style.width) || 1); }

file: html.js