Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
update the minified and cleanup some white space
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckcarpenter committed Jun 21, 2014
1 parent bd859ec commit e7d3510
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
7 changes: 6 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
"strict": false,
"trailing": true,
"smarttabs": true,
"globals": {"define": false}
"supernew": false,
"globals": {
"define": false,
"XDomainRequest": false,
"ActiveXObject": false
}
}
34 changes: 17 additions & 17 deletions js/rem.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@
try {
var xhr = getXMLHttpRequest(),
isOldIE = document.all;

xhr.open( 'GET', url, true );
xhr.send(null);

// Better way for IE versions detection: http://tanalin.com/en/articles/ie-version-js/

if ( !isOldIE || (isOldIE && window.XMLHttpRequest) ){ //If IE is greater than 6
// This targets modern browsers and modern versions of IE,
// which don't need the "new" keyword.
xhr.onreadystatechange = function () {
xhr.onreadystatechange = function() {
if ( xhr.readyState === 4 ){
callback(xhr, i);
} // else { callback function on AJAX error }
Expand Down Expand Up @@ -214,41 +214,41 @@
css = [], // initialize the array holding the parsed rules for use later
fontSize = '';

// Notice: rem is a "root em" that means that in case when html element size was changed by css
// or style we should not change document.documentElement.fontSize to 1em - only body size should be changed
// Notice: rem is a "root em" that means that in case when html element size was changed by css
// or style we should not change document.documentElement.fontSize to 1em - only body size should be changed
// to 1em for calculation

fontSize = (function () {
var doc = document,
docElement = doc.documentElement,
body = doc.body || doc.createElement('body'),
isFakeBody = !doc.body,
div = doc.createElement('div'),
div = doc.createElement('div'),
currentSize = body.style.fontSize,
size;

if ( isFakeBody ) {
docElement.appendChild( body );
}
div.style.cssText = 'width:1em; position:absolute; visibility:hidden; padding: 0;';

div.style.cssText = 'width:1em; position:absolute; visibility:hidden; padding: 0;';

body.style.fontSize = '1em';

body.appendChild( div );
size = div.offsetWidth;

if ( isFakeBody ) {
docElement.removeChild( body );
}
else {
body.removeChild( div );
body.style.fontSize = currentSize;
body.style.fontSize = currentSize;
}

return size;
}());

processLinks();
} // else { do nothing, you are awesome and have REM support }

Expand Down
6 changes: 3 additions & 3 deletions js/rem.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e7d3510

Please sign in to comment.