Skip to content
Browse files

Put the length calc element into the body rather than the documentEle…

…ment, fixes unit conversions in IE<8
  • Loading branch information...
1 parent 47558e5 commit a6d464067afd13488af228b5c13aa4955e4fb599 Jason Johnston committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 sources/Length.js
View
6 sources/Length.js
@@ -7,7 +7,7 @@
*/
PIE.Length = (function() {
var lengthCalcEl = doc.createElement( 'length-calc' ),
- parent = doc.documentElement,
+ parent = doc.body,
s = lengthCalcEl.style,
conversions = {},
units = [ 'mm', 'cm', 'in', 'pt', 'pc' ],
@@ -19,13 +19,13 @@ PIE.Length = (function() {
parent.appendChild( lengthCalcEl );
while( i-- ) {
- lengthCalcEl.style.width = '100' + units[i];
+ s.width = '100' + units[i];
conversions[ units[i] ] = lengthCalcEl.offsetWidth / 100;
}
parent.removeChild( lengthCalcEl );
// All calcs from here on will use 1em
- lengthCalcEl.style.width = '1em';
+ s.width = '1em';
function Length( val ) {

0 comments on commit a6d4640

Please sign in to comment.
Something went wrong with that request. Please try again.