|
122 | 122 | try {
|
123 | 123 | var xhr = getXMLHttpRequest(),
|
124 | 124 | isOldIE = document.all;
|
125 |
| - |
| 125 | + |
126 | 126 | xhr.open( 'GET', url, true );
|
127 | 127 | xhr.send(null);
|
128 |
| - |
| 128 | + |
129 | 129 | // Better way for IE versions detection: http://tanalin.com/en/articles/ie-version-js/
|
130 |
| - |
| 130 | + |
131 | 131 | if ( !isOldIE || (isOldIE && window.XMLHttpRequest) ){ //If IE is greater than 6
|
132 | 132 | // This targets modern browsers and modern versions of IE,
|
133 | 133 | // which don't need the "new" keyword.
|
134 |
| - xhr.onreadystatechange = function () { |
| 134 | + xhr.onreadystatechange = function() { |
135 | 135 | if ( xhr.readyState === 4 ){
|
136 | 136 | callback(xhr, i);
|
137 | 137 | } // else { callback function on AJAX error }
|
|
214 | 214 | css = [], // initialize the array holding the parsed rules for use later
|
215 | 215 | fontSize = '';
|
216 | 216 |
|
217 |
| - // Notice: rem is a "root em" that means that in case when html element size was changed by css |
218 |
| - // or style we should not change document.documentElement.fontSize to 1em - only body size should be changed |
| 217 | + // Notice: rem is a "root em" that means that in case when html element size was changed by css |
| 218 | + // or style we should not change document.documentElement.fontSize to 1em - only body size should be changed |
219 | 219 | // to 1em for calculation
|
220 |
| - |
| 220 | + |
221 | 221 | fontSize = (function () {
|
222 | 222 | var doc = document,
|
223 | 223 | docElement = doc.documentElement,
|
224 | 224 | body = doc.body || doc.createElement('body'),
|
225 | 225 | isFakeBody = !doc.body,
|
226 |
| - div = doc.createElement('div'), |
| 226 | + div = doc.createElement('div'), |
227 | 227 | currentSize = body.style.fontSize,
|
228 | 228 | size;
|
229 |
| - |
| 229 | + |
230 | 230 | if ( isFakeBody ) {
|
231 | 231 | docElement.appendChild( body );
|
232 | 232 | }
|
233 |
| - |
234 |
| - div.style.cssText = 'width:1em; position:absolute; visibility:hidden; padding: 0;'; |
235 |
| - |
| 233 | + |
| 234 | + div.style.cssText = 'width:1em; position:absolute; visibility:hidden; padding: 0;'; |
| 235 | + |
236 | 236 | body.style.fontSize = '1em';
|
237 |
| - |
| 237 | + |
238 | 238 | body.appendChild( div );
|
239 | 239 | size = div.offsetWidth;
|
240 |
| - |
| 240 | + |
241 | 241 | if ( isFakeBody ) {
|
242 | 242 | docElement.removeChild( body );
|
243 | 243 | }
|
244 | 244 | else {
|
245 | 245 | body.removeChild( div );
|
246 |
| - body.style.fontSize = currentSize; |
| 246 | + body.style.fontSize = currentSize; |
247 | 247 | }
|
248 |
| - |
| 248 | + |
249 | 249 | return size;
|
250 | 250 | }());
|
251 |
| - |
| 251 | + |
252 | 252 | processLinks();
|
253 | 253 | } // else { do nothing, you are awesome and have REM support }
|
254 | 254 |
|
|
0 commit comments