纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1406 lines
50 KiB

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