Permalink
Browse files

js : add fakeBody for body. Fixes #8

  • Loading branch information...
1 parent 1e41589 commit f647cd96d42881b965603504b56a26dddad5cfd5 @desandro committed Oct 7, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 masonry.js
View
@@ -62,14 +62,17 @@
// Hard work done by Mike Sherov https://github.com/jquery/jquery/pull/616
var body = document.getElementsByTagName("body")[0],
- div = document.createElement('div');
+ div = document.createElement('div'),
+ fakeBody = body || document.createElement('body');
div.style.marginTop = '1%';
- body.appendChild( div );
+ fakeBody.appendChild( div );
var supportsPercentMargin = getStyle( div ).marginTop !== '1%';
- body.removeChild( div );
+ fakeBody.removeChild( div );
+
+ // TODO remove fakebody if it's fake?
// https://github.com/mikesherov/jquery/blob/191c9c1be/src/css.js

0 comments on commit f647cd9

Please sign in to comment.