1/*! 2 * Modernizr v2.7.1 3 * www.modernizr.com 4 * 5 * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton 6 * Available under the BSD and MIT licenses: www.modernizr.com/license/ 7 */ 8 9/* 10 * Modernizr tests which native CSS3 and HTML5 features are available in 11 * the current UA and makes the results available to you in two ways: 12 * as properties on a global Modernizr object, and as classes on the 13 * <html> element. This information allows you to progressively enhance 14 * your pages with a granular level of control over the experience. 15 * 16 * Modernizr has an optional (not included) conditional resource loader 17 * called Modernizr.load(), based on Yepnope.js (yepnopejs.com). 18 * To get a build that includes Modernizr.load(), as well as choosing 19 * which tests to include, go to www.modernizr.com/download/ 20 * 21 * Authors Faruk Ates, Paul Irish, Alex Sexton 22 * Contributors Ryan Seddon, Ben Alman 23 */ 24 25 26window.Modernizr = (function( window, document, undefined ) { 27 28 var version = '2.7.1', 29 30 Modernizr = {}, 31 32 /*>>cssclasses*/ 33 // option for enabling the HTML classes to be added 34 enableClasses = true, 35 /*>>cssclasses*/ 36 37 docElement = document.documentElement, 38 39 /** 40 * Create our "modernizr" element that we do most feature tests on. 41 */ 42 mod = 'modernizr', 43 modElem = document.createElement(mod), 44 mStyle = modElem.style, 45 46 /** 47 * Create the input element for various Web Forms feature tests. 48 */ 49 inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ , 50 51 /*>>smile*/ 52 smile = ':)', 53 /*>>smile*/ 54 55 toString = {}.toString, 56 57 // TODO :: make the prefixes more granular 58 /*>>prefixes*/ 59 // List of property values to set for css tests. See ticket #21 60 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), 61 /*>>prefixes*/ 62 63 /*>>domprefixes*/ 64 // Following spec is to expose vendor-specific style properties as: 65 // elem.style.WebkitBorderRadius 66 // and the following would be incorrect: 67 // elem.style.webkitBorderRadius 68 69 // Webkit ghosts their properties in lowercase but Opera & Moz do not. 70 // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+ 71 // erik.eae.net/archives/2008/03/10/21.48.10/ 72 73 // More here: github.com/Modernizr/Modernizr/issues/issue/21 74 omPrefixes = 'Webkit Moz O ms', 75 76 cssomPrefixes = omPrefixes.split(' '), 77 78 domPrefixes = omPrefixes.toLowerCase().split(' '), 79 /*>>domprefixes*/ 80 81 /*>>ns*/ 82 ns = {'svg': 'http://www.w3.org/2000/svg'}, 83 /*>>ns*/ 84 85 tests = {}, 86 inputs = {}, 87 attrs = {}, 88 89 classes = [], 90 91 slice = classes.slice, 92 93 featureName, // used in testing loop 94 95 96 /*>>teststyles*/ 97 // Inject element with style element and some CSS rules 98 injectElementWithStyles = function( rule, callback, nodes, testnames ) { 99 100 var style, ret, node, docOverflow, 101 div = document.createElement('div'), 102 // After page load injecting a fake body doesn't work so check if body exists 103 body = document.body, 104 // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it. 105 fakeBody = body || document.createElement('body'); 106 107 if ( parseInt(nodes, 10) ) { 108 // In order not to give false positives we create a node for each test 109 // This also allows the method to scale for unspecified uses 110 while ( nodes-- ) { 111 node = document.createElement('div'); 112 node.id = testnames ? testnames[nodes] : mod + (nodes + 1); 113 div.appendChild(node); 114 } 115 } 116 117 // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed 118 // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element 119 // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements. 120 // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx 121 // Documents served as xml will throw if using ­ so use xml friendly encoded version. See issue #277 122 style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); 123 div.id = mod; 124 // IE6 will false positive on some tests due to the style element inside the test div somehow interfer
124ing offsetHeight, so insert it into body or fakebody. 125 // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270 126 (body ? div : fakeBody).innerHTML += style; 127 fakeBody.appendChild(div); 128 if ( !body ) { 129 //avoid crashing IE8, if background image is used 130 fakeBody.style.background = ''; 131 //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible 132 fakeBody.style.overflow = 'hidden'; 133 docOverflow = docElement.style.overflow; 134 docElement.style.overflow = 'hidden'; 135 docElement.appendChild(fakeBody); 136 } 137 138 ret = callback(div, rule); 139 // If this is done after page load we don't want to remove the body so check if body exists 140 if ( !body ) { 141 fakeBody.parentNode.removeChild(fakeBody); 142 docElement.style.overflow = docOverflow; 143 } else { 144 div.parentNode.removeChild(div); 145 } 146 147 return !!ret; 148 149 }, 150 /*>>teststyles*/ 151 152 /*>>mq*/ 153 // adapted from matchMedia polyfill 154 // by Scott Jehl and Paul Irish 155 // gist.github.com/786768 156 testMediaQuery = function( mq ) { 157 158 var matchMedia = window.matchMedia || window.msMatchMedia; 159 if ( matchMedia ) { 160 return matchMedia(mq).matches; 161 } 162 163 var bool; 164 165 injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) { 166 bool = (window.getComputedStyle ? 167 getComputedStyle(node, null) : 168 node.currentStyle)['position'] == 'absolute'; 169 }); 170 171 return bool; 172 173 }, 174 /*>>mq*/ 175 176 177 /*>>hasevent*/ 178 // 179 // isEventSupported determines if a given element supports the given event 180 // kangax.github.com/iseventsupported/ 181 // 182 // The following results are known incorrects: 183 // Modernizr.hasEvent("webkitTransitionEnd", elem) // false negative 184 // Modernizr.hasEvent("textInput") // in Webkit. github.com/Modernizr/Modernizr/issues/333 185 // ... 186 isEventSupported = (function() { 187 188 var TAGNAMES = { 189 'select': 'input', 'change': 'input', 190 'submit': 'form', 'reset': 'form', 191 'error': 'img', 'load': 'img', 'abort': 'img' 192 }; 193 194 function isEventSupported( eventName, element ) { 195 196 element = element || document.createElement(TAGNAMES[eventName] || 'div'); 197 eventName = 'on' + eventName; 198 199 // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize", whereas `in` "catches" those 200 var isSupported = eventName in element; 201 202 if ( !isSupported ) { 203 // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element 204 if ( !element.setAttribute ) { 205 element = document.createElement('div'); 206 } 207 if ( element.setAttribute && element.removeAttribute ) { 208 element.setAttribute(eventName, ''); 209 isSupported = is(element[eventName], 'function'); 210 211 // If property was created, "remove it" (by setting value to `undefined`) 212 if ( !is(element[eventName], 'undefined') ) { 213 element[eventName] = undefined; 214 } 215 element.removeAttribute(eventName); 216 } 217 } 218 219 element = null; 220 return isSupported; 221 } 222 return isEventSupported; 223 })(), 224 /*>>hasevent*/ 225 226 // TODO :: Add flag for hasownprop ? didn't last time 227 228 // hasOwnProperty shim by kangax needed for Safari 2.0 support 229 _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; 230 231 if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { 232 hasOwnProp = function (object, property) { 233 return _hasOwnProperty.call(object, property); 234 }; 235 } 236 else { 237 hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */ 238 return ((property in object) && is(object.constructor.prototype[property], 'undefined')); 239 }; 240 } 241 242 // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js 243 // es5.github.com/#x15.3.4.5 244 245 if (!Function.prototype.bind) { 246 Function.prototype.bind = function bind(that) { 247 248 var target = this; 249 250 if (typeof target != "function") { 251 throw new TypeError(); 252 } 253 254 var args = slice.call(arguments, 1), 255 bound = function () { 256 257 if (this instanceof bound) { 258 259 var F = function(){}; 260 F.prototype = target.prototype; 261 var self = new F(); 262 263 var result = target.apply( 264 self, 265 args.concat(slice.call(arguments)) 266 ); 267 if (Object(result) === result) { 268 return result; 269 } 270 return self; 271 272 } else { 273 274 return target.apply( 275 that, 276 args.concat(slice.call(arguments)) 277 ); 278 279 } 280 281 }; 282 283 return bound; 284 }; 285 } 286 287 /** 288 * setCss applies given styles to the Modernizr DOM node. 289 */ 290 function setCss( str ) { 291 mStyle.cssText = str; 292 } 293 294 /** 295 * setCssAll extrapolates all vendor-specific css strings. 296 */ 297 function setCssAll( str1, str2 ) { 298 return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); 299 } 300 301 /** 302 * is returns a boolean for if typeof obj is exactly type. 303 */ 304 function is( obj, type ) { 305 return typeof obj === type; 306 } 307 308 /** 309 * contains returns a boolean for if substr is found within str. 310 */ 311 function contains( str, substr ) {
312 return !!~('' + str).indexOf(substr); 313 } 314 315 /*>>testprop*/ 316 317 // testProps is a generic CSS / DOM property test. 318 319 // In testing support for a given CSS property, it's legit to test: 320 // `elem.style[styleName] !== undefined` 321 // If the property is supported it will return an empty string, 322 // if unsupported it will return undefined. 323 324 // We'll take advantage of this quick test and skip setting a style 325 // on our modernizr element, but instead just testing undefined vs 326 // empty string. 327 328 // Because the testing of the CSS property names (with "-", as 329 // opposed to the camelCase DOM properties) is non-portable and 330 // non-standard but works in WebKit and IE (but not Gecko or Opera), 331 // we explicitly reject properties with dashes so that authors 332 // developing in WebKit or IE first don't end up with 333 // browser-specific content by accident. 334 335 function testProps( props, prefixed ) { 336 for ( var i in props ) { 337 var prop = props[i]; 338 if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { 339 return prefixed == 'pfx' ? prop : true; 340 } 341 } 342 return false; 343 } 344 /*>>testprop*/ 345 346 // TODO :: add testDOMProps 347 /** 348 * testDOMProps is a generic DOM property test; if a browser supports 349 * a certain property, it won't return undefined for it. 350 */ 351 function testDOMProps( props, obj, elem ) { 352 for ( var i in props ) { 353 var item = obj[props[i]]; 354 if ( item !== undefined) { 355 356 // return the property name as a string 357 if (elem === false) return props[i]; 358 359 // let's bind a function 360 if (is(item, 'function')){ 361 // default to autobind unless override 362 return item.bind(elem || obj); 363 } 364 365 // return the unbound function or obj or value 366 return item; 367 } 368 } 369 return false; 370 } 371 372 /*>>testallprops*/ 373 /** 374 * testPropsAll tests a list of DOM properties we want to check against. 375 * We specify literally ALL possible (known and/or likely) properties on 376 * the element including the non-vendor prefixed one, for forward- 377 * compatibility. 378 */ 379 function testPropsAll( prop, prefixed, elem ) { 380 381 var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), 382 props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); 383 384 // did they call .prefixed('boxSizing') or are we just testing a prop? 385 if(is(prefixed, "string") || is(prefixed, "undefined")) { 386 return testProps(props, prefixed); 387 388 // otherwise, they called .prefixed('requestAnimationFrame', window[, elem]) 389 } else { 390 props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); 391 return testDOMProps(props, prefixed, elem); 392 } 393 } 394 /*>>testallprops*/ 395 396 397 /** 398 * Tests 399 * ----- 400 */ 401 402 // The *new* flexbox 403 // dev.w3.org/csswg/css3-flexbox 404 405 tests['flexbox'] = function() { 406 return testPropsAll('flexWrap'); 407 }; 408 409 // The *old* flexbox 410 // www.w3.org/TR/2009/WD-css3-flexbox-20090723/ 411 412 tests['flexboxlegacy'] = function() { 413 return testPropsAll('boxDirection'); 414 }; 415 416 // On the S60 and BB Storm, getContext exists, but always returns undefined 417 // so we actually have to call getContext() to verify 418 // github.com/Modernizr/Modernizr/issues/issue/97/ 419 420 tests['canvas'] = function() { 421 var elem = document.createElement('canvas'); 422 return !!(elem.getContext && elem.getContext('2d')); 423 }; 424 425 tests['canvastext'] = function() { 426 return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); 427 }; 428 429 // webk.it/70117 is tracking a legit WebGL feature detect proposal 430 431 // We do a soft detect which may false positive in order to avoid 432 // an expensive context creation: bugzil.la/732441 433 434 tests['webgl'] = function() { 435 return !!window.WebGLRenderingContext; 436 }; 437 438 /* 439 * The Modernizr.touch test only indicates if the browser supports 440 * touch events, which does not necessarily reflect a touchscreen 441 * device, as evidenced by tablets running Windows 7 or, alas, 442 * the Palm Pre / WebOS (touch) phones. 443 * 444 * Additionally, Chrome (desktop) used to lie about its support on this, 445 * but that has since been rectified: crbug.com/36415 446 * 447 * We also test for Firefox 4 Multitouch Support. 448 * 449 * For more info, see: modernizr.github.com/Modernizr/touch.html 450 */ 451 452 tests['touch'] = function() { 453 var bool; 454 455 if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { 456 bool = true; 457 } else { 458 injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { 459 bool = node.offsetTop === 9; 460 }); 461 } 462 463 return bool; 464 }; 465 466 467 // geolocation is often considered a trivial feature detect... 468 // Turns out, it's quite tricky to get right: 469 // 470 // Using !!navigator.geolocation does two things we don't want. It: 471 // 1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513 472 // 2. Disables page caching in WebKit: webk.it/43956 473 // 474 // Meanwhile, in Firefox < 8, an about:config setting could expose 475 // a false positive that would throw an exception: bugzil.la/688158 476 477 tests['geolocation'] = function() { 478 return 'geolocation' in navigator; 479 }; 480 481 482 tests['postmessage'] = function() { 483 return !!window.postMessage; 484 }; 485 486 487 // Chrome incognito mode used to throw an exception when using openDatabase 488 // It doesn't anymore. 489 tests['websqldatabase'] = function() {
490 return !!window.openDatabase; 491 }; 492 493 // Vendors had inconsistent prefixing with the experimental Indexed DB: 494 // - Webkit's implementation is accessible through webkitIndexedDB 495 // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB 496 // For speed, we don't test the legacy (and beta-only) indexedDB 497 tests['indexedDB'] = function() { 498 return !!testPropsAll("indexedDB", window); 499 }; 500 501 // documentMode logic from YUI to filter out IE8 Compat Mode 502 // which false positives. 503 tests['hashchange'] = function() { 504 return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7); 505 }; 506 507 // Per 1.6: 508 // This used to be Modernizr.historymanagement but the longer 509 // name has been deprecated in favor of a shorter and property-matching one. 510 // The old API is still available in 1.6, but as of 2.0 will throw a warning, 511 // and in the first release thereafter disappear entirely. 512 tests['history'] = function() { 513 return !!(window.history && history.pushState); 514 }; 515 516 tests['draganddrop'] = function() { 517 var div = document.createElement('div'); 518 return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); 519 }; 520 521 // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10 522 // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17. 523 // FF10 still uses prefixes, so check for it until then. 524 // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/ 525 tests['websockets'] = function() { 526 return 'WebSocket' in window || 'MozWebSocket' in window; 527 }; 528 529 530 // css-tricks.com/rgba-browser-support/ 531 tests['rgba'] = function() { 532 // Set an rgba() color and check the returned value 533 534 setCss('background-color:rgba(150,255,150,.5)'); 535 536 return contains(mStyle.backgroundColor, 'rgba'); 537 }; 538 539 tests['hsla'] = function() { 540 // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally, 541 // except IE9 who retains it as hsla 542 543 setCss('background-color:hsla(120,40%,100%,.5)'); 544 545 return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla'); 546 }; 547 548 tests['multiplebgs'] = function() { 549 // Setting multiple images AND a color on the background shorthand property 550 // and then querying the style.background property value for the number of 551 // occurrences of "url(" is a reliable method for detecting ACTUAL support for this! 552 553 setCss('background:url(https://),url(https://),red url(https://)'); 554 555 // If the UA supports multiple backgrounds, there should be three occurrences 556 // of the string "url(" in the return value for elemStyle.background 557 558 return (/(url\s*\(.*?){3}/).test(mStyle.background); 559 }; 560 561 562 563 // this will false positive in Opera Mini 564 // github.com/Modernizr/Modernizr/issues/396 565 566 tests['backgroundsize'] = function() { 567 return testPropsAll('backgroundSize'); 568 }; 569 570 tests['borderimage'] = function() { 571 return testPropsAll('borderImage'); 572 }; 573 574 575 // Super comprehensive table about all the unique implementations of 576 // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance 577
578 tests['borderradius'] = function() { 579 return testPropsAll('borderRadius'); 580 }; 581 582 // WebOS unfortunately false positives on this test. 583 tests['boxshadow'] = function() { 584 return testPropsAll('boxShadow'); 585 }; 586 587 // FF3.0 will false positive on this test 588 tests['textshadow'] = function() { 589 return document.createElement('div').style.textShadow === ''; 590 }; 591 592 593 tests['opacity'] = function() { 594 // Browsers that actually have CSS Opacity implemented have done so 595 // according to spec, which means their return values are within the 596 // range of [0.0,1.0] - including the leading zero. 597 598 setCssAll('opacity:.55'); 599 600 // The non-literal . in this regex is intentional: 601 // German Chrome returns this value as 0,55 602 // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632 603 return (/^0.55$/).test(mStyle.opacity); 604 }; 605 606 607 // Note, Android < 4 will pass this test, but can only animate 608 // a single property at a time 609 // daneden.me/2011/12/putting-up-with-androids-bullshit/ 610 tests['cssanimations'] = function() { 611 return testPropsAll('animationName'); 612 }; 613 614 615 tests['csscolumns'] = function() { 616 return testPropsAll('columnCount'); 617 }; 618 619 620 tests['cssgradients'] = function() { 621 /** 622 * For CSS Gradients syntax, please see: 623 * webkit.org/blog/175/introducing-css-gradients/ 624 * developer.mozilla.org/en/CSS/-moz-linear-gradient 625 * developer.mozilla.org/en/CSS/-moz-radial-gradient 626 * dev.w3.org/csswg/css3-images/#gradients- 627 */ 628 629 var str1 = 'background-image:', 630 str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', 631 str3 = 'linear-gradient(left top,#9f9, white);'; 632 633 setCss( 634 // legacy webkit syntax (FIXME: remove when syntax not in use anymore) 635 (str1 + '-webkit- '.split(' ').join(str2 + str1) + 636 // standard syntax // trailing 'background-image:' 637 prefixes.join(str3 + str1)).slice(0, -str1.length) 638 ); 639 640 return contains(mStyle.backgroundImage, 'gradient'); 641 }; 642 643 644 tests['cssreflections'] = function() { 645 return testPropsAll('boxReflect'); 646 }; 647 648 649 tests['csstransforms'] = function() { 650 return !!testPropsAll('transform'); 651 }; 652 653 654 tests['csstransforms3d'] = function() { 655 656 var ret = !!testPropsAll('perspective'); 657 658 // Webkit's 3D transforms are passed off to the browser's own graphics renderer. 659 // It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in 660 // some conditions. As a result, Webkit typically recognizes the syntax but 661 // will sometimes throw a false positive, thus we must do a more thorough check: 662 if ( ret && 'webkitPerspective' in docElement.style ) { 663 664 // Webkit allows this media query to succeed only if the feature is enabled. 665 // `@media (transform-3d),(-webkit-transform-3d){ ... }` 666 injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { 667 ret = node.offsetLeft === 9 && node.offsetHeight === 3; 668 }); 669 } 670 return ret; 671 }; 672 673 674 tests['csstransitions'] = function() { 675 return testPropsAll('transition'); 676 }; 677 678 679 /*>>fontface*/ 680 // @font-face detection routine by Diego Perini 681 // javascript.nwbox.com/CSSSupport/ 682 683 // false positives: 684 // WebOS github.com/Modernizr/Modernizr/issues/342 685 // WP7 github.com/Modernizr/Modernizr/issues/538 686 tests['fontface'] = function() { 687 var bool; 688 689 injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { 690 var style = document.getElementById('smodernizr'), 691 sheet = style.sheet || style.styleSheet, 692 cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; 693 694 bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; 695 }); 696 697 return bool; 698 }; 699 /*>>fontface*/ 700 701 // CSS generated content detection 702 tests['generatedcontent'] = function() { 703 var bool; 704 705 injectElementWithStyles(['#',mod,'{font:0/0 a}
705#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { 706 bool = node.offsetHeight >= 3; 707 }); 708 709 return bool; 710 }; 711 712 713 714 // These tests evaluate support of the video/audio elements, as well as 715 // testing what types of content they support. 716 // 717 // We're using the Boolean constructor here, so that we can extend the value 718 // e.g. Modernizr.video // true 719 // Modernizr.video.ogg // 'probably' 720 // 721 // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845 722 // thx to NielsLeenheer and zcorpan 723 724 // Note: in some older browsers, "no" was a return value instead of empty string. 725 // It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2 726 // It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5 727 728 tests['video'] = function() { 729 var elem = document.createElement('video'), 730 bool = false; 731 732 // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224 733 try { 734 if ( bool = !!elem.canPlayType ) { 735 bool = new Boolean(bool); 736 bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); 737
738 // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546 739 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); 740 741 bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); 742 } 743 744 } catch(e) { } 745 746 return bool; 747 }; 748 749 tests['audio'] = function() { 750 var elem = document.createElement('audio'), 751 bool = false; 752 753 try { 754 if ( bool = !!elem.canPlayType ) { 755 bool = new Boolean(bool); 756 bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); 757 bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); 758 759 // Mimetypes accepted: 760 // developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements 761 // bit.ly/iphoneoscodecs 762 bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); 763 bool.m4a = ( elem.canPlayType('audio/x-m4a;') || 764 elem.canPlayType('audio/aac;')) .replace(/^no$/,''); 765 } 766 } catch(e) { } 767 768 return bool; 769 }; 770 771 772 // In FF4, if disabled, window.localStorage should === null. 773 774 // Normally, we could not test that directly and need to do a 775 // `('localStorage' in window) && ` test first because otherwise Firefox will 776 // throw bugzil.la/365772 if cookies are disabled 777 778 // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem 779 // will throw the exception: 780 // QUOTA_EXCEEDED_ERRROR DOM Exception 22. 781 // Peculiarly, getItem and removeItem calls do not throw. 782 783 // Because we are forced to try/catch this, we'll go aggressive. 784 785 // Just FWIW: IE8 Compat mode supports these features completely: 786 // www.quirksmode.org/dom/html5.html 787 // But IE8 doesn't support either with local files 788 789 tests['localstorage'] = function() { 790 try { 791 localStorage.setItem(mod, mod); 792 localStorage.removeItem(mod); 793 return true; 794 } catch(e) { 795 return false; 796 } 797 }; 798 799 tests['sessionstorage'] = function() { 800 try { 801 sessionStorage.setItem(mod, mod); 802 sessionStorage.removeItem(mod); 803 return true; 804 } catch(e) { 805 return false; 806 } 807 }; 808 809 810 tests['webworkers'] = function() { 811 return !!window.Worker; 812 }; 813 814 815 tests['applicationcache'] = function() { 816 return !!window.applicationCache; 817 }; 818 819 820 // Thanks to Erik Dahlstrom 821 tests['svg'] = function() { 822 return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; 823 }; 824 825 // specifically for SVG inline in HTML, not within XHTML 826 // test page: paulirish.com/demo/inline-svg 827 tests['inlinesvg'] = function() { 828 var div = document.createElement('div'); 829 div.innerHTML = '<svg/>'; 830 return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; 831 }; 832 833 // SVG SMIL animation 834 tests['smil'] = function() { 835 return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate'))); 836 }; 837 838 // This test is only for clip paths in SVG proper, not clip paths on HTML content 839 // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg 840 841 // However read the comments to dig into applying SVG clippaths to HTML content here: 842 // github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491 843 tests['svgclippaths'] = function() { 844 return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath'))); 845 }; 846 847 /*>>webforms*/ 848 // input features and input types go directly onto the ret object, bypassing the tests loop. 849 // Hold this guy to execute in a moment. 850 function webforms() { 851 /*>>input*/ 852 // Run through HTML5's new input attributes to see if the UA understands any. 853 // We're using f which is the <input> element created early on 854 // Mike Taylr has created a comprehensive resource for testing these attributes 855 // when applied to all input types: 856 // miketaylr.com/code/input-type-attr.html 857 // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 858 859 // Only input placeholder is tested while textarea's placeholder is not. 860 // Currently Safari 4 and Opera 11 have support only for the input placeholder 861 // Both tests are available in feature-detects/forms-placeholder.js 862 Modernizr['input'] = (function( props ) { 863 for ( var i = 0, len = props.length; i < len; i++ ) { 864 attrs[ props[i] ] = !!(props[i] in inputElem); 865 } 866 if (attrs.list){ 867 // safari false positive's on datalist: webk.it/74252 868 // see also github.com/Modernizr/Modernizr/issues/146 869 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); 870 } 871 return attrs; 872 })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); 873 /*>>input*/ 874 875 /*>>inputtypes*/ 876 // Run through HTML5's new input types to see if the UA understands any. 877 // This is put behind the tests runloop because it doesn't return a 878 // true/false like all the other tests; instead, it returns an object 879 // containing each input type with its corresponding true/false value 880 881 // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/ 882 Modernizr['inputtypes'] = (function(props) { 883 884 for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { 885 886 inputElem.setAttribute('type', inputElemType = props[i]); 887 bool = inputElem.type !== 'text'; 888 889 // We first check to see if the type we give it sticks.. 890 // If the type does, we feed it a textual value, which shouldn't be val
890id. 891 // If the value doesn't stick, we know there's input sanitization which infers a custom UI 892 if ( bool ) { 893 894 inputElem.value = smile; 895 inputElem.style.cssText = 'position:absolute;visibility:hidden;'; 896 897 if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { 898 899 docElement.appendChild(inputElem); 900 defaultView = document.defaultView; 901 902 // Safari 2-4 allows the smiley as a value, despite making a slider 903 bool = defaultView.getComputedStyle && 904 defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && 905 // Mobile android web browser has false positive, so must 906 // check the height to see if the widget is actually there. 907 (inputElem.offsetHeight !== 0); 908 909 docElement.removeChild(inputElem); 910 911 } else if ( /^(search|tel)$/.test(inputElemType) ){ 912 // Spec doesn't define any special parsing or detectable UI 913 // behaviors so we pass these through as true 914 915 // Interestingly, opera fails the earlier test, so it doesn't 916 // even make it here. 917 918 } else if ( /^(url|email)$/.test(inputElemType) ) { 919 // Real url and email support comes with prebaked validation. 920 bool = inputElem.checkValidity && inputElem.checkValidity() === false; 921 922 } else { 923 // If the upgraded input compontent rejects the :) text, we got a winner 924 bool = inputElem.value != smile; 925 } 926 } 927 928 inputs[ props[i] ] = !!bool; 929 } 930 return inputs; 931 })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); 932 /*>>inputtypes*/ 933 } 934 /*>>webforms*/ 935 936 937 // End of test definitions 938 // ----------------------- 939 940 941 942 // Run through all tests and detect their support in the current UA. 943 // todo: hypothetically we could be doing an array of tests and use a basic loop here. 944 for ( var feature in tests ) { 945 if ( hasOwnProp(tests, feature) ) { 946 // run the test, throw the return value into the Modernizr, 947 // then based on that boolean, define an appropriate className 948 // and push it into an array of classes we'll join later. 949 featureName = feature.toLowerCase(); 950 Modernizr[featureName] = tests[feature](); 951 952 classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); 953 } 954 } 955 956 /*>>webforms*/ 957 // input tests need to run. 958 Modernizr.input || webforms(); 959 /*>>webforms*/ 960 961 962 /** 963 * addTest allows the user to define their own feature tests 964 * the result will be added onto the Modernizr object, 965 * as well as an appropriate className set on the html element 966 * 967 * @param feature - String naming the feature 968 * @param test - Function returning true if feature is supported, false if not 969 */ 970 Modernizr.addTest = function ( feature, test ) { 971 if ( typeof feature == 'object' ) { 972 for ( var key in feature ) { 973 if ( hasOwnProp( feature, key ) ) { 974 Modernizr.addTest( key, feature[ key ] ); 975 } 976 } 977 } else { 978 979 feature = feature.toLowerCase(); 980 981 if ( Modernizr[feature] !== undefined ) { 982 // we're going to quit if you're trying to overwrite an existing test 983 // if we were to allow it, we'd do this: 984 // var re = new RegExp("\\b(no-)?" + feature + "\\b"); 985 // docElement.className = docElement.className.replace( re, '' ); 986 // but, no rly, stuff 'em. 987 return Modernizr; 988 } 989 990 test = typeof test == 'function' ? test() : test; 991 992 if (typeof enableClasses !== "undefined" && enableClasses) { 993 docElement.className += ' ' + (test ? '' : 'no-') + feature; 994 } 995 Modernizr[feature] = test; 996 997 } 998 999 return Modernizr; // allow chaining. 1000 }; 1001 1002 1003 // Reset modElem.cssText to nothing to reduce memory footprint. 1004 setCss(''); 1005 modElem = inputElem = null; 1006 1007 /*>>shiv*/ 1008 /** 1009 * @preserve HTML5 Shiv prev3.7.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed 1010 */ 1011 ;(function(window, document) { 1012 /*jshint evil:true */ 1013 /** version */ 1014 var version = '3.7.0'; 1015 1016 /** Preset options */ 1017 var options = window.html5 || {}; 1018 1019 /** Used to skip problem elements */ 1020 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 1021 1022 /** Not all elements can be cloned in IE **/ 1023 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 1024 1025 /** Detect whether the browser supports default html5 styles */ 1026 var supportsHtml5Styles; 1027 1028 /** Name of the expando, to work with multiple documents or to re-shiv one document */ 1029 var expando = '_html5shiv'; 1030 1031 /** The id for the the documents expando */ 1032 var expanID = 0; 1033 1034 /** Cached data for each document */ 1035 var expandoData = {}; 1036 1037 /** Detect whether the browser supports unknown elements */ 1038 var supportsUnknownElements; 1039 1040 (function() { 1041 try { 1042 var a = document.createElement('a'); 1043 a.innerHTML = '<xyz></xyz>'; 1044 //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles 1045 supportsHtml5Styles = ('hidden' in a); 1046 1047 supportsUnknownElements = a.childNodes.length == 1 || (function() { 1048 // assign a false positive if unable to shiv 1049 (document.createElement)('a'); 1050 var frag = document.createDocumentFragment(); 1051 return ( 1052 typeof frag.cloneNode == 'undefined' || 1053 typeof frag.createDocumentFragment == 'undefined' || 1054 typeof frag.createElement == 'undefined' 1055 ); 1056 }()); 1057 } catch(e) { 1058 // assign a false positive if detection fails => unable to shiv 1059 supportsHtml5Styles = true; 1060 supportsUnknownElements = true; 1061 } 1062 1063 }()); 1064 1065 /*--------------------------------------------------------------------------*/ 1066 1067 /** 1068 * Creates a style sheet with the given CSS text and adds it to the document. 1069 * @private 1070 * @param {Document} ownerDocument The document. 1071 * @param {String} cssText The CSS text. 1072 * @returns {StyleSheet} The style element. 1073 */ 1074 function addStyleSheet(ownerDocument, cssText) { 1075 var p = ownerDocument.createElement('p'), 1076 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 1077 1078 p.innerHTML = 'x<style>' + cssText + '</style>'; 1079 return parent.insertBefore(p.lastChild, parent.firstChild); 1080 } 1081 1082 /** 1083 * Returns the value of `html5.elements` as an array.
vendor: 5,515 bytes, lines 1084-1223
1084 * @private 1085 * @returns {Array} An array of shived element node names. 1086 */ 1087 function getElements() { 1088 var elements = html5.elements; 1089 return typeof elements == 'string' ? elements.split(' ') : elements; 1090 } 1091 1092 /** 1093 * Returns the data associated to the given document 1094 * @private 1095 * @param {Document} ownerDocument The document. 1096 * @returns {Object} An object of data. 1097 */ 1098 function getExpandoData(ownerDocument) { 1099 var data = expandoData[ownerDocument[expando]]; 1100 if (!data) { 1101 data = {}; 1102 expanID++; 1103 ownerDocument[expando] = expanID; 1104 expandoData[expanID] = data; 1105 } 1106 return data; 1107 } 1108 1109 /** 1110 * returns a shived element for the given nodeName and document 1111 * @memberOf html5 1112 * @param {String} nodeName name of the element 1113 * @param {Document} ownerDocument The context document. 1114 * @returns {Object} The shived element. 1115 */ 1116 function createElement(nodeName, ownerDocument, data){ 1117 if (!ownerDocument) { 1118 ownerDocument = document; 1119 } 1120 if(supportsUnknownElements){ 1121 return ownerDocument.createElement(nodeName); 1122 } 1123 if (!data) { 1124 data = getExpandoData(ownerDocument); 1125 } 1126 var node; 1127 1128 if (data.cache[nodeName]) { 1129 node = data.cache[nodeName].cloneNode(); 1130 } else if (saveClones.test(nodeName)) { 1131 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 1132 } else { 1133 node = data.createElem(nodeName); 1134 } 1135 1136 // Avoid adding some elements to fragments in IE < 9 because 1137 // * Attributes like `name` or `type` cannot be set/changed once an element 1138 // is inserted into a document/fragment 1139 // * Link elements with `src` attributes that are inaccessible, as with 1140 // a 403 response, will cause the tab/window to crash 1141 // * Script elements appended to fragments will execute when their `src` 1142 // or `text` property is set 1143 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; 1144 } 1145 1146 /** 1147 * returns a shived DocumentFragment for the given document 1148 * @memberOf html5 1149 * @param {Document} ownerDocument The context document. 1150 * @returns {Object} The shived DocumentFragment. 1151 */ 1152 function createDocumentFragment(ownerDocument, data){ 1153 if (!ownerDocument) { 1154 ownerDocument = document; 1155 } 1156 if(supportsUnknownElements){ 1157 return ownerDocument.createDocumentFragment(); 1158 } 1159 data = data || getExpandoData(ownerDocument); 1160 var clone = data.frag.cloneNode(), 1161 i = 0, 1162 elems = getElements(), 1163 l = elems.length; 1164 for(;i<l;i++){ 1165 clone.createElement(elems[i]); 1166 } 1167 return clone; 1168 } 1169 1170 /** 1171 * Shivs the `createElement` and `createDocumentFragment` methods of the document. 1172 * @private 1173 * @param {Document|DocumentFragment} ownerDocument The document. 1174 * @param {Object} data of the document. 1175 */ 1176 function shivMethods(ownerDocument, data) { 1177 if (!data.cache) { 1178 data.cache = {}; 1179 data.createElem = ownerDocument.createElement; 1180 data.createFrag = ownerDocument.createDocumentFragment; 1181 data.frag = data.createFrag(); 1182 } 1183 1184 1185 ownerDocument.createElement = function(nodeName) { 1186 //abort shiv 1187 if (!html5.shivMethods) { 1188 return data.createElem(nodeName); 1189 } 1190 return createElement(nodeName, ownerDocument, data); 1191 }; 1192 1193 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 1194 'var n=f.cloneNode(),c=n.createElement;' + 1195 'h.shivMethods&&(' + 1196 // unroll the `createElement` calls 1197 getElements().join().replace(/[\w\-]+/g, function(nodeName) { 1198 data.createElem(nodeName); 1199 data.frag.createElement(nodeName); 1200 return 'c("' + nodeName + '")'; 1201 }) + 1202 ');return n}' 1203 )(html5, data.frag); 1204 } 1205 1206 /*--------------------------------------------------------------------------*/ 1207 1208 /** 1209 * Shivs the given document. 1210 * @memberOf html5 1211 * @param {Document} ownerDocument The document to shiv. 1212 * @returns {Document} The shived document. 1213 */ 1214 function shivDocument(ownerDocument) { 1215 if (!ownerDocument) { 1216 ownerDocument = document; 1217 } 1218 var data = getExpandoData(ownerDocument); 1219 1220 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 1221 data.hasCSS = !!addStyleSheet(ownerDocument, 1222 // corrects block display not defined in IE6/7/8/9 1223 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
1223play:block}' + 1224 // adds styling not present in IE6/7/8/9 1225 'mark{background:#FF0;color:#000}' + 1226 // hides non-rendered elements 1227 'template{display:none}' 1228 ); 1229 } 1230 if (!supportsUnknownElements) { 1231 shivMethods(ownerDocument, data); 1232 } 1233 return ownerDocument; 1234 } 1235 1236 /*--------------------------------------------------------------------------*/ 1237 1238 /** 1239 * The `html5` object is exposed so that more elements can be shived and 1240 * existing shiving can be detected on iframes. 1241 * @type Object 1242 * @example 1243 * 1244 * // options can be changed before the script is included 1245 * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; 1246 */ 1247 var html5 = { 1248 1249 /** 1250 * An array or space separated string of node names of the elements to shiv. 1251 * @memberOf html5 1252 * @type Array|String 1253 */ 1254 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video', 1255 1256 /** 1257 * current version of html5shiv 1258 */ 1259 'version': version, 1260 1261 /** 1262 * A flag to indicate that the HTML5 style sheet should be inserted. 1263 * @memberOf html5 1264 * @type Boolean 1265 */ 1266 'shivCSS': (options.shivCSS !== false), 1267 1268 /** 1269 * Is equal to true if a browser supports creating unknown/HTML5 elements 1270 * @memberOf html5 1271 * @type boolean 1272 */ 1273 'supportsUnknownElements': supportsUnknownElements, 1274 1275 /** 1276 * A flag to indicate that the document's `createElement` and `createDocumentFragment` 1277 * methods should be overwritten. 1278 * @memberOf html5 1279 * @type Boolean 1280 */ 1281 'shivMethods': (options.shivMethods !== false), 1282 1283 /** 1284 * A string to describe the type of `html5` object ("default" or "default print"). 1285 * @memberOf html5
1286 * @type String 1287 */ 1288 'type': 'default', 1289 1290 // shivs the document according to the specified `html5` object options 1291 'shivDocument': shivDocument, 1292 1293 //creates a shived element 1294 createElement: createElement, 1295 1296 //creates a shived documentFragment 1297 createDocumentFragment: createDocumentFragment 1298 }; 1299 1300 /*--------------------------------------------------------------------------*/ 1301 1302 // expose html5 1303 window.html5 = html5; 1304 1305 // shiv the document 1306 shivDocument(document); 1307 1308 }(this, document)); 1309 /*>>shiv*/ 1310 1311 // Assign private properties to the return object with prefix 1312 Modernizr._version = version; 1313 1314 // expose these for the plugin API. Look in the source for how to join() them against your input 1315 /*>>prefixes*/ 1316 Modernizr._prefixes = prefixes; 1317 /*>>prefixes*/ 1318 /*>>domprefixes*/ 1319 Modernizr._domPrefixes = domPrefixes; 1320 Modernizr._cssomPrefixes = cssomPrefixes; 1321 /*>>domprefixes*/ 1322 1323 /*>>mq*/ 1324 // Modernizr.mq tests a given media query, live against the current state of the window 1325 // A few important notes: 1326 // * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false 1327 // * A max-width or orientation query will be evaluated against the current state, which may change later. 1328 // * You must specify values. Eg. If you are testing support for the min-width media query use: 1329 // Modernizr.mq('(min-width:0)') 1330 // usage: 1331 // Modernizr.mq('only screen and (max-width:768)') 1332 Modernizr.mq = testMediaQuery; 1333 /*>>mq*/ 1334 1335 /*>>hasevent*/ 1336 // Modernizr.hasEvent() detects support for a given event, with an optional element to test on 1337 // Modernizr.hasEvent('gesturestart', elem) 1338 Modernizr.hasEvent = isEventSupported; 1339 /*>>hasevent*/ 1340 1341 /*>>testprop*/ 1342 // Modernizr.testProp() investigates whether a given style property is recognized 1343 // Note that the property names must be provided in the camelCase variant. 1344 // Modernizr.testProp('pointerEvents') 1345 Modernizr.testProp = function(prop){ 1346 return testProps([prop]); 1347 }; 1348 /*>>testprop*/ 1349 1350 /*>>testallprops*/ 1351 // Modernizr.testAllProps() investigates whether a given style property, 1352 // or any of its vendor-prefixed variants, is recognized 1353 // Note that the property names must be provided in the camelCase variant. 1354 // Modernizr.testAllProps('boxSizing') 1355 Modernizr.testAllProps = testPropsAll; 1356 /*>>testallprops*/ 1357 1358 1359 /*>>teststyles*/ 1360 // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards 1361 // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... }) 1362 Modernizr.testStyles = injectElementWithStyles; 1363 /*>>teststyles*/ 1364 1365 1366 /*>>prefixed*/ 1367 // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input 1368 // Modernizr.prefixed('boxSizing') // 'MozBoxSizing' 1369 1370 // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style. 1371 // Return values will also be the camelCase variant, if you need to translate that to hypenated style use: 1372 // 1373 // str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-'); 1374 1375 // If you're trying to ascertain which transition end event to bind to, you might do something like... 1376 // 1377 // var transEndEventNames = { 1378 // 'WebkitTransition' : 'webkitTransitionEnd', 1379 // 'MozTransition' : 'transitionend', 1380 // 'OTransition' : 'oTransitionEnd', 1381 // 'msTransition' : 'MSTransitionEnd', 1382 // 'transition' : 'transitionend' 1383 // }, 1384 // transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ]; 1385 1386 Modernizr.prefixed = function(prop, obj, elem){ 1387 if(!obj) { 1388 return testPropsAll(prop, 'pfx'); 1389 } else { 1390 // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame' 1391 return testPropsAll(prop, obj, elem); 1392 } 1393 }; 1394 /*>>prefixed*/ 1395 1396 1397 /*>>cssclasses*/ 1398 // Remove "no-js" class from <html> element, if it exists: 1399 docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + 1400 1401 // Add the new classes to the <html> element. 1402 (enableClasses ? ' js ' + classes.join(' ') : ''); 1403 /*>>cssclasses*/ 1404 1405 return Modernizr; 1406 1407})(this, this.document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.