customizr 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1554 @@
1
+ /*!
2
+ * modernizr v3.13.0
3
+ * Build https://modernizr.com/download?-cors-input-smil-addtest-printshiv-setclasses-testprop-dontmin-cssclassprefix:prefixed-
4
+ *
5
+ * Copyright (c)
6
+ * Faruk Ates
7
+ * Paul Irish
8
+ * Alex Sexton
9
+ * Ryan Seddon
10
+ * Patrick Kettner
11
+ * Stu Cox
12
+ * Richard Herrera
13
+ * Veeck
14
+
15
+ * MIT License
16
+ */
17
+
18
+ /*
19
+ * Modernizr tests which native CSS3 and HTML5 features are available in the
20
+ * current UA and makes the results available to you in two ways: as properties on
21
+ * a global `Modernizr` object, and as classes on the `<html>` element. This
22
+ * information allows you to progressively enhance your pages with a granular level
23
+ * of control over the experience.
24
+ */
25
+
26
+ ;(function(scriptGlobalObject, window, document, undefined){
27
+
28
+ var tests = [];
29
+
30
+
31
+ /**
32
+ * ModernizrProto is the constructor for Modernizr
33
+ *
34
+ * @class
35
+ * @access public
36
+ */
37
+ var ModernizrProto = {
38
+ _version: '3.13.0',
39
+
40
+ // Any settings that don't work as separate modules
41
+ // can go in here as configuration.
42
+ _config: {
43
+ 'classPrefix': 'prefixed-',
44
+ 'enableClasses': true,
45
+ 'enableJSClass': true,
46
+ 'usePrefixes': true
47
+ },
48
+
49
+ // Queue of tests
50
+ _q: [],
51
+
52
+ // Stub these for people who are listening
53
+ on: function(test, cb) {
54
+ // I don't really think people should do this, but we can
55
+ // safe guard it a bit.
56
+ // -- NOTE:: this gets WAY overridden in src/addTest for actual async tests.
57
+ // This is in case people listen to synchronous tests. I would leave it out,
58
+ // but the code to *disallow* sync tests in the real version of this
59
+ // function is actually larger than this.
60
+ var self = this;
61
+ setTimeout(function() {
62
+ cb(self[test]);
63
+ }, 0);
64
+ },
65
+
66
+ addTest: function(name, fn, options) {
67
+ tests.push({name: name, fn: fn, options: options});
68
+ },
69
+
70
+ addAsyncTest: function(fn) {
71
+ tests.push({name: null, fn: fn});
72
+ }
73
+ };
74
+
75
+
76
+
77
+ // Fake some of Object.create so we can force non test results to be non "own" properties.
78
+ var Modernizr = function() {};
79
+ Modernizr.prototype = ModernizrProto;
80
+
81
+ // Leak modernizr globally when you `require` it rather than force it here.
82
+ // Overwrite name so constructor name is nicer :D
83
+ Modernizr = new Modernizr();
84
+
85
+
86
+
87
+ var classes = [];
88
+
89
+
90
+ /**
91
+ * is returns a boolean if the typeof an obj is exactly type.
92
+ *
93
+ * @access private
94
+ * @function is
95
+ * @param {*} obj - A thing we want to check the type of
96
+ * @param {string} type - A string to compare the typeof against
97
+ * @returns {boolean} true if the typeof the first parameter is exactly the specified type, false otherwise
98
+ */
99
+ function is(obj, type) {
100
+ return typeof obj === type;
101
+ }
102
+
103
+ ;
104
+
105
+ /**
106
+ * Run through all tests and detect their support in the current UA.
107
+ *
108
+ * @access private
109
+ * @returns {void}
110
+ */
111
+ function testRunner() {
112
+ var featureNames;
113
+ var feature;
114
+ var aliasIdx;
115
+ var result;
116
+ var nameIdx;
117
+ var featureName;
118
+ var featureNameSplit;
119
+
120
+ for (var featureIdx in tests) {
121
+ if (tests.hasOwnProperty(featureIdx)) {
122
+ featureNames = [];
123
+ feature = tests[featureIdx];
124
+ // run the test, throw the return value into the Modernizr,
125
+ // then based on that boolean, define an appropriate className
126
+ // and push it into an array of classes we'll join later.
127
+ //
128
+ // If there is no name, it's an 'async' test that is run,
129
+ // but not directly added to the object. That should
130
+ // be done with a post-run addTest call.
131
+ if (feature.name) {
132
+ featureNames.push(feature.name.toLowerCase());
133
+
134
+ if (feature.options && feature.options.aliases && feature.options.aliases.length) {
135
+ // Add all the aliases into the names list
136
+ for (aliasIdx = 0; aliasIdx < feature.options.aliases.length; aliasIdx++) {
137
+ featureNames.push(feature.options.aliases[aliasIdx].toLowerCase());
138
+ }
139
+ }
140
+ }
141
+
142
+ // Run the test, or use the raw value if it's not a function
143
+ result = is(feature.fn, 'function') ? feature.fn() : feature.fn;
144
+
145
+ // Set each of the names on the Modernizr object
146
+ for (nameIdx = 0; nameIdx < featureNames.length; nameIdx++) {
147
+ featureName = featureNames[nameIdx];
148
+ // Support dot properties as sub tests. We don't do checking to make sure
149
+ // that the implied parent tests have been added. You must call them in
150
+ // order (either in the test, or make the parent test a dependency).
151
+ //
152
+ // Cap it to TWO to make the logic simple and because who needs that kind of subtesting
153
+ // hashtag famous last words
154
+ featureNameSplit = featureName.split('.');
155
+
156
+ if (featureNameSplit.length === 1) {
157
+ Modernizr[featureNameSplit[0]] = result;
158
+ } else {
159
+ // cast to a Boolean, if not one already or if it doesnt exist yet (like inputtypes)
160
+ if (!Modernizr[featureNameSplit[0]] || Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
161
+ Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
162
+ }
163
+
164
+ Modernizr[featureNameSplit[0]][featureNameSplit[1]] = result;
165
+ }
166
+
167
+ classes.push((result ? '' : 'no-') + featureNameSplit.join('-'));
168
+ }
169
+ }
170
+ }
171
+ }
172
+ ;
173
+
174
+ /**
175
+ * docElement is a convenience wrapper to grab the root element of the document
176
+ *
177
+ * @access private
178
+ * @returns {HTMLElement|SVGElement} The root element of the document
179
+ */
180
+ var docElement = document.documentElement;
181
+
182
+
183
+ /**
184
+ * A convenience helper to check if the document we are running in is an SVG document
185
+ *
186
+ * @access private
187
+ * @returns {boolean}
188
+ */
189
+ var isSVG = docElement.nodeName.toLowerCase() === 'svg';
190
+
191
+
192
+
193
+ /**
194
+ * setClasses takes an array of class names and adds them to the root element
195
+ *
196
+ * @access private
197
+ * @function setClasses
198
+ * @param {string[]} classes - Array of class names
199
+ */
200
+ // Pass in an and array of class names, e.g.:
201
+ // ['no-webp', 'borderradius', ...]
202
+ function setClasses(classes) {
203
+ var className = docElement.className;
204
+ var classPrefix = Modernizr._config.classPrefix || '';
205
+
206
+ if (isSVG) {
207
+ className = className.baseVal;
208
+ }
209
+
210
+ // Change `no-js` to `js` (independently of the `enableClasses` option)
211
+ // Handle classPrefix on this too
212
+ if (Modernizr._config.enableJSClass) {
213
+ var reJS = new RegExp('(^|\\s)' + classPrefix + 'no-js(\\s|$)');
214
+ className = className.replace(reJS, '$1' + classPrefix + 'js$2');
215
+ }
216
+
217
+ if (Modernizr._config.enableClasses) {
218
+ // Add the new classes
219
+ if (classes.length > 0) {
220
+ className += ' ' + classPrefix + classes.join(' ' + classPrefix);
221
+ }
222
+ if (isSVG) {
223
+ docElement.className.baseVal = className;
224
+ } else {
225
+ docElement.className = className;
226
+ }
227
+ }
228
+ }
229
+
230
+ ;
231
+
232
+ /**
233
+ * hasOwnProp is a shim for hasOwnProperty that is needed for Safari 2.0 support
234
+ *
235
+ * @author kangax
236
+ * @access private
237
+ * @function hasOwnProp
238
+ * @param {object} object - The object to check for a property
239
+ * @param {string} property - The property to check for
240
+ * @returns {boolean}
241
+ */
242
+
243
+ // hasOwnProperty shim by kangax needed for Safari 2.0 support
244
+ var hasOwnProp;
245
+
246
+ (function() {
247
+ var _hasOwnProperty = ({}).hasOwnProperty;
248
+ /* istanbul ignore else */
249
+ /* we have no way of testing IE 5.5 or safari 2,
250
+ * so just assume the else gets hit */
251
+ if (!is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined')) {
252
+ hasOwnProp = function(object, property) {
253
+ return _hasOwnProperty.call(object, property);
254
+ };
255
+ }
256
+ else {
257
+ hasOwnProp = function(object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */
258
+ return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
259
+ };
260
+ }
261
+ })();
262
+
263
+
264
+
265
+
266
+ // _l tracks listeners for async tests, as well as tests that execute after the initial run
267
+ ModernizrProto._l = {};
268
+
269
+ /**
270
+ * Modernizr.on is a way to listen for the completion of async tests. Being
271
+ * asynchronous, they may not finish before your scripts run. As a result you
272
+ * will get a possibly false negative `undefined` value.
273
+ *
274
+ * @memberOf Modernizr
275
+ * @name Modernizr.on
276
+ * @access public
277
+ * @function on
278
+ * @param {string} feature - String name of the feature detect
279
+ * @param {Function} cb - Callback function returning a Boolean - true if feature is supported, false if not
280
+ * @returns {void}
281
+ * @example
282
+ *
283
+ * ```js
284
+ * Modernizr.on('flash', function( result ) {
285
+ * if (result) {
286
+ * // the browser has flash
287
+ * } else {
288
+ * // the browser does not have flash
289
+ * }
290
+ * });
291
+ * ```
292
+ */
293
+ ModernizrProto.on = function(feature, cb) {
294
+ // Create the list of listeners if it doesn't exist
295
+ if (!this._l[feature]) {
296
+ this._l[feature] = [];
297
+ }
298
+
299
+ // Push this test on to the listener list
300
+ this._l[feature].push(cb);
301
+
302
+ // If it's already been resolved, trigger it on next tick
303
+ if (Modernizr.hasOwnProperty(feature)) {
304
+ // Next Tick
305
+ setTimeout(function() {
306
+ Modernizr._trigger(feature, Modernizr[feature]);
307
+ }, 0);
308
+ }
309
+ };
310
+
311
+ /**
312
+ * _trigger is the private function used to signal test completion and run any
313
+ * callbacks registered through [Modernizr.on](#modernizr-on)
314
+ *
315
+ * @memberOf Modernizr
316
+ * @name Modernizr._trigger
317
+ * @access private
318
+ * @function _trigger
319
+ * @param {string} feature - string name of the feature detect
320
+ * @param {Function|boolean} [res] - A feature detection function, or the boolean =
321
+ * result of a feature detection function
322
+ * @returns {void}
323
+ */
324
+ ModernizrProto._trigger = function(feature, res) {
325
+ if (!this._l[feature]) {
326
+ return;
327
+ }
328
+
329
+ var cbs = this._l[feature];
330
+
331
+ // Force async
332
+ setTimeout(function() {
333
+ var i, cb;
334
+ for (i = 0; i < cbs.length; i++) {
335
+ cb = cbs[i];
336
+ cb(res);
337
+ }
338
+ }, 0);
339
+
340
+ // Don't trigger these again
341
+ delete this._l[feature];
342
+ };
343
+
344
+ /**
345
+ * addTest allows you to define your own feature detects that are not currently
346
+ * included in Modernizr (under the covers it's the exact same code Modernizr
347
+ * uses for its own [feature detections](https://github.com/Modernizr/Modernizr/tree/master/feature-detects)).
348
+ * Just like the official detects, the result
349
+ * will be added onto the Modernizr object, as well as an appropriate className set on
350
+ * the html element when configured to do so
351
+ *
352
+ * @memberOf Modernizr
353
+ * @name Modernizr.addTest
354
+ * @optionName Modernizr.addTest()
355
+ * @optionProp addTest
356
+ * @access public
357
+ * @function addTest
358
+ * @param {string|object} feature - The string name of the feature detect, or an
359
+ * object of feature detect names and test
360
+ * @param {Function|boolean} test - Function returning true if feature is supported,
361
+ * false if not. Otherwise a boolean representing the results of a feature detection
362
+ * @returns {object} the Modernizr object to allow chaining
363
+ * @example
364
+ *
365
+ * The most common way of creating your own feature detects is by calling
366
+ * `Modernizr.addTest` with a string (preferably just lowercase, without any
367
+ * punctuation), and a function you want executed that will return a boolean result
368
+ *
369
+ * ```js
370
+ * Modernizr.addTest('itsTuesday', function() {
371
+ * var d = new Date();
372
+ * return d.getDay() === 2;
373
+ * });
374
+ * ```
375
+ *
376
+ * When the above is run, it will set Modernizr.itstuesday to `true` when it is tuesday,
377
+ * and to `false` every other day of the week. One thing to notice is that the names of
378
+ * feature detect functions are always lowercased when added to the Modernizr object. That
379
+ * means that `Modernizr.itsTuesday` will not exist, but `Modernizr.itstuesday` will.
380
+ *
381
+ *
382
+ * Since we only look at the returned value from any feature detection function,
383
+ * you do not need to actually use a function. For simple detections, just passing
384
+ * in a statement that will return a boolean value works just fine.
385
+ *
386
+ * ```js
387
+ * Modernizr.addTest('hasjquery', 'jQuery' in window);
388
+ * ```
389
+ *
390
+ * Just like before, when the above runs `Modernizr.hasjquery` will be true if
391
+ * jQuery has been included on the page. Not using a function saves a small amount
392
+ * of overhead for the browser, as well as making your code much more readable.
393
+ *
394
+ * Finally, you also have the ability to pass in an object of feature names and
395
+ * their tests. This is handy if you want to add multiple detections in one go.
396
+ * The keys should always be a string, and the value can be either a boolean or
397
+ * function that returns a boolean.
398
+ *
399
+ * ```js
400
+ * var detects = {
401
+ * 'hasjquery': 'jQuery' in window,
402
+ * 'itstuesday': function() {
403
+ * var d = new Date();
404
+ * return d.getDay() === 2;
405
+ * }
406
+ * }
407
+ *
408
+ * Modernizr.addTest(detects);
409
+ * ```
410
+ *
411
+ * There is really no difference between the first methods and this one, it is
412
+ * just a convenience to let you write more readable code.
413
+ */
414
+ function addTest(feature, test) {
415
+
416
+ if (typeof feature === 'object') {
417
+ for (var key in feature) {
418
+ if (hasOwnProp(feature, key)) {
419
+ addTest(key, feature[ key ]);
420
+ }
421
+ }
422
+ } else {
423
+
424
+ feature = feature.toLowerCase();
425
+ var featureNameSplit = feature.split('.');
426
+ var last = Modernizr[featureNameSplit[0]];
427
+
428
+ // Again, we don't check for parent test existence. Get that right, though.
429
+ if (featureNameSplit.length === 2) {
430
+ last = last[featureNameSplit[1]];
431
+ }
432
+
433
+ if (typeof last !== 'undefined') {
434
+ // we're going to quit if you're trying to overwrite an existing test
435
+ // if we were to allow it, we'd do this:
436
+ // var re = new RegExp("\\b(no-)?" + feature + "\\b");
437
+ // docElement.className = docElement.className.replace( re, '' );
438
+ // but, no rly, stuff 'em.
439
+ return Modernizr;
440
+ }
441
+
442
+ test = typeof test === 'function' ? test() : test;
443
+
444
+ // Set the value (this is the magic, right here).
445
+ if (featureNameSplit.length === 1) {
446
+ Modernizr[featureNameSplit[0]] = test;
447
+ } else {
448
+ // cast to a Boolean, if not one already
449
+ if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
450
+ Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
451
+ }
452
+
453
+ Modernizr[featureNameSplit[0]][featureNameSplit[1]] = test;
454
+ }
455
+
456
+ // Set a single class (either `feature` or `no-feature`)
457
+ setClasses([(!!test && test !== false ? '' : 'no-') + featureNameSplit.join('-')]);
458
+
459
+ // Trigger the event
460
+ Modernizr._trigger(feature, test);
461
+ }
462
+
463
+ return Modernizr; // allow chaining.
464
+ }
465
+
466
+ // After all the tests are run, add self to the Modernizr prototype
467
+ Modernizr._q.push(function() {
468
+ ModernizrProto.addTest = addTest;
469
+ });
470
+
471
+
472
+
473
+
474
+ /**
475
+ * @optionName html5printshiv
476
+ * @optionProp html5printshiv
477
+ */
478
+
479
+ // Take the html5 variable out of the html5shiv scope so we can return it.
480
+ var html5;
481
+ if (!isSVG) {
482
+ /**
483
+ * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
484
+ */
485
+ ;(function(window, document) {
486
+ /*jshint evil:true */
487
+ /** version */
488
+ var version = '3.7.3';
489
+
490
+ /** Preset options */
491
+ var options = window.html5 || {};
492
+
493
+ /** Used to skip problem elements */
494
+ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
495
+
496
+ /** Not all elements can be cloned in IE **/
497
+ 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;
498
+
499
+ /** Detect whether the browser supports default html5 styles */
500
+ var supportsHtml5Styles;
501
+
502
+ /** Name of the expando, to work with multiple documents or to re-shiv one document */
503
+ var expando = '_html5shiv';
504
+
505
+ /** The id for the the documents expando */
506
+ var expanID = 0;
507
+
508
+ /** Cached data for each document */
509
+ var expandoData = {};
510
+
511
+ /** Detect whether the browser supports unknown elements */
512
+ var supportsUnknownElements;
513
+
514
+ (function() {
515
+ try {
516
+ var a = document.createElement('a');
517
+ a.innerHTML = '<xyz></xyz>';
518
+ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
519
+ supportsHtml5Styles = ('hidden' in a);
520
+
521
+ supportsUnknownElements = a.childNodes.length == 1 || (function() {
522
+ // assign a false positive if unable to shiv
523
+ (document.createElement)('a');
524
+ var frag = document.createDocumentFragment();
525
+ return (
526
+ typeof frag.cloneNode == 'undefined' ||
527
+ typeof frag.createDocumentFragment == 'undefined' ||
528
+ typeof frag.createElement == 'undefined'
529
+ );
530
+ }());
531
+ } catch(e) {
532
+ // assign a false positive if detection fails => unable to shiv
533
+ supportsHtml5Styles = true;
534
+ supportsUnknownElements = true;
535
+ }
536
+
537
+ }());
538
+
539
+ /*--------------------------------------------------------------------------*/
540
+
541
+ /**
542
+ * Creates a style sheet with the given CSS text and adds it to the document.
543
+ * @private
544
+ * @param {Document} ownerDocument The document.
545
+ * @param {String} cssText The CSS text.
546
+ * @returns {StyleSheet} The style element.
547
+ */
548
+ function addStyleSheet(ownerDocument, cssText) {
549
+ var p = ownerDocument.createElement('p'),
550
+ parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
551
+
552
+ p.innerHTML = 'x<style>' + cssText + '</style>';
553
+ return parent.insertBefore(p.lastChild, parent.firstChild);
554
+ }
555
+
556
+ /**
557
+ * Returns the value of `html5.elements` as an array.
558
+ * @private
559
+ * @returns {Array} An array of shived element node names.
560
+ */
561
+ function getElements() {
562
+ var elements = html5.elements;
563
+ return typeof elements == 'string' ? elements.split(' ') : elements;
564
+ }
565
+
566
+ /**
567
+ * Extends the built-in list of html5 elements
568
+ * @memberOf html5
569
+ * @param {String|Array} newElements whitespace separated list or array of new element names to shiv
570
+ * @param {Document} ownerDocument The context document.
571
+ */
572
+ function addElements(newElements, ownerDocument) {
573
+ var elements = html5.elements;
574
+ if(typeof elements != 'string'){
575
+ elements = elements.join(' ');
576
+ }
577
+ if(typeof newElements != 'string'){
578
+ newElements = newElements.join(' ');
579
+ }
580
+ html5.elements = elements +' '+ newElements;
581
+ shivDocument(ownerDocument);
582
+ }
583
+
584
+ /**
585
+ * Returns the data associated to the given document
586
+ * @private
587
+ * @param {Document} ownerDocument The document.
588
+ * @returns {Object} An object of data.
589
+ */
590
+ function getExpandoData(ownerDocument) {
591
+ var data = expandoData[ownerDocument[expando]];
592
+ if (!data) {
593
+ data = {};
594
+ expanID++;
595
+ ownerDocument[expando] = expanID;
596
+ expandoData[expanID] = data;
597
+ }
598
+ return data;
599
+ }
600
+
601
+ /**
602
+ * returns a shived element for the given nodeName and document
603
+ * @memberOf html5
604
+ * @param {String} nodeName name of the element
605
+ * @param {Document} ownerDocument The context document.
606
+ * @returns {Object} The shived element.
607
+ */
608
+ function createElement(nodeName, ownerDocument, data){
609
+ if (!ownerDocument) {
610
+ ownerDocument = document;
611
+ }
612
+ if(supportsUnknownElements){
613
+ return ownerDocument.createElement(nodeName);
614
+ }
615
+ if (!data) {
616
+ data = getExpandoData(ownerDocument);
617
+ }
618
+ var node;
619
+
620
+ if (data.cache[nodeName]) {
621
+ node = data.cache[nodeName].cloneNode();
622
+ } else if (saveClones.test(nodeName)) {
623
+ node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
624
+ } else {
625
+ node = data.createElem(nodeName);
626
+ }
627
+
628
+ // Avoid adding some elements to fragments in IE < 9 because
629
+ // * Attributes like `name` or `type` cannot be set/changed once an element
630
+ // is inserted into a document/fragment
631
+ // * Link elements with `src` attributes that are inaccessible, as with
632
+ // a 403 response, will cause the tab/window to crash
633
+ // * Script elements appended to fragments will execute when their `src`
634
+ // or `text` property is set
635
+ return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
636
+ }
637
+
638
+ /**
639
+ * returns a shived DocumentFragment for the given document
640
+ * @memberOf html5
641
+ * @param {Document} ownerDocument The context document.
642
+ * @returns {Object} The shived DocumentFragment.
643
+ */
644
+ function createDocumentFragment(ownerDocument, data){
645
+ if (!ownerDocument) {
646
+ ownerDocument = document;
647
+ }
648
+ if(supportsUnknownElements){
649
+ return ownerDocument.createDocumentFragment();
650
+ }
651
+ data = data || getExpandoData(ownerDocument);
652
+ var clone = data.frag.cloneNode(),
653
+ i = 0,
654
+ elems = getElements(),
655
+ l = elems.length;
656
+ for(;i<l;i++){
657
+ clone.createElement(elems[i]);
658
+ }
659
+ return clone;
660
+ }
661
+
662
+ /**
663
+ * Shivs the `createElement` and `createDocumentFragment` methods of the document.
664
+ * @private
665
+ * @param {Document|DocumentFragment} ownerDocument The document.
666
+ * @param {Object} data of the document.
667
+ */
668
+ function shivMethods(ownerDocument, data) {
669
+ if (!data.cache) {
670
+ data.cache = {};
671
+ data.createElem = ownerDocument.createElement;
672
+ data.createFrag = ownerDocument.createDocumentFragment;
673
+ data.frag = data.createFrag();
674
+ }
675
+
676
+
677
+ ownerDocument.createElement = function(nodeName) {
678
+ //abort shiv
679
+ if (!html5.shivMethods) {
680
+ return data.createElem(nodeName);
681
+ }
682
+ return createElement(nodeName, ownerDocument, data);
683
+ };
684
+
685
+ ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
686
+ 'var n=f.cloneNode(),c=n.createElement;' +
687
+ 'h.shivMethods&&(' +
688
+ // unroll the `createElement` calls
689
+ getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
690
+ data.createElem(nodeName);
691
+ data.frag.createElement(nodeName);
692
+ return 'c("' + nodeName + '")';
693
+ }) +
694
+ ');return n}'
695
+ )(html5, data.frag);
696
+ }
697
+
698
+ /*--------------------------------------------------------------------------*/
699
+
700
+ /**
701
+ * Shivs the given document.
702
+ * @memberOf html5
703
+ * @param {Document} ownerDocument The document to shiv.
704
+ * @returns {Document} The shived document.
705
+ */
706
+ function shivDocument(ownerDocument) {
707
+ if (!ownerDocument) {
708
+ ownerDocument = document;
709
+ }
710
+ var data = getExpandoData(ownerDocument);
711
+
712
+ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
713
+ data.hasCSS = !!addStyleSheet(ownerDocument,
714
+ // corrects block display not defined in IE6/7/8/9
715
+ 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
716
+ // adds styling not present in IE6/7/8/9
717
+ 'mark{background:#FF0;color:#000}' +
718
+ // hides non-rendered elements
719
+ 'template{display:none}'
720
+ );
721
+ }
722
+ if (!supportsUnknownElements) {
723
+ shivMethods(ownerDocument, data);
724
+ }
725
+ return ownerDocument;
726
+ }
727
+
728
+ /*--------------------------------------------------------------------------*/
729
+
730
+ /**
731
+ * The `html5` object is exposed so that more elements can be shived and
732
+ * existing shiving can be detected on iframes.
733
+ * @type Object
734
+ * @example
735
+ *
736
+ * // options can be changed before the script is included
737
+ * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
738
+ */
739
+ var html5 = {
740
+
741
+ /**
742
+ * An array or space separated string of node names of the elements to shiv.
743
+ * @memberOf html5
744
+ * @type Array|String
745
+ */
746
+ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
747
+
748
+ /**
749
+ * current version of html5shiv
750
+ */
751
+ 'version': version,
752
+
753
+ /**
754
+ * A flag to indicate that the HTML5 style sheet should be inserted.
755
+ * @memberOf html5
756
+ * @type Boolean
757
+ */
758
+ 'shivCSS': (options.shivCSS !== false),
759
+
760
+ /**
761
+ * Is equal to true if a browser supports creating unknown/HTML5 elements
762
+ * @memberOf html5
763
+ * @type boolean
764
+ */
765
+ 'supportsUnknownElements': supportsUnknownElements,
766
+
767
+ /**
768
+ * A flag to indicate that the document's `createElement` and `createDocumentFragment`
769
+ * methods should be overwritten.
770
+ * @memberOf html5
771
+ * @type Boolean
772
+ */
773
+ 'shivMethods': (options.shivMethods !== false),
774
+
775
+ /**
776
+ * A string to describe the type of `html5` object ("default" or "default print").
777
+ * @memberOf html5
778
+ * @type String
779
+ */
780
+ 'type': 'default',
781
+
782
+ // shivs the document according to the specified `html5` object options
783
+ 'shivDocument': shivDocument,
784
+
785
+ //creates a shived element
786
+ createElement: createElement,
787
+
788
+ //creates a shived documentFragment
789
+ createDocumentFragment: createDocumentFragment,
790
+
791
+ //extends list of elements
792
+ addElements: addElements
793
+ };
794
+
795
+ /*--------------------------------------------------------------------------*/
796
+
797
+ // expose html5
798
+ window.html5 = html5;
799
+
800
+ // shiv the document
801
+ shivDocument(document);
802
+
803
+ /*------------------------------- Print Shiv -------------------------------*/
804
+
805
+ /** Used to filter media types */
806
+ var reMedia = /^$|\b(?:all|print)\b/;
807
+
808
+ /** Used to namespace printable elements */
809
+ var shivNamespace = 'html5shiv';
810
+
811
+ /** Detect whether the browser supports shivable style sheets */
812
+ var supportsShivableSheets = !supportsUnknownElements && (function() {
813
+ // assign a false negative if unable to shiv
814
+ var docEl = document.documentElement;
815
+ return !(
816
+ typeof document.namespaces == 'undefined' ||
817
+ typeof document.parentWindow == 'undefined' ||
818
+ typeof docEl.applyElement == 'undefined' ||
819
+ typeof docEl.removeNode == 'undefined' ||
820
+ typeof window.attachEvent == 'undefined'
821
+ );
822
+ }());
823
+
824
+ /*--------------------------------------------------------------------------*/
825
+
826
+ /**
827
+ * Wraps all HTML5 elements in the given document with printable elements.
828
+ * (eg. the "header" element is wrapped with the "html5shiv:header" element)
829
+ * @private
830
+ * @param {Document} ownerDocument The document.
831
+ * @returns {Array} An array wrappers added.
832
+ */
833
+ function addWrappers(ownerDocument) {
834
+ var node,
835
+ nodes = ownerDocument.getElementsByTagName('*'),
836
+ index = nodes.length,
837
+ reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
838
+ result = [];
839
+
840
+ while (index--) {
841
+ node = nodes[index];
842
+ if (reElements.test(node.nodeName)) {
843
+ result.push(node.applyElement(createWrapper(node)));
844
+ }
845
+ }
846
+ return result;
847
+ }
848
+
849
+ /**
850
+ * Creates a printable wrapper for the given element.
851
+ * @private
852
+ * @param {Element} element The element.
853
+ * @returns {Element} The wrapper.
854
+ */
855
+ function createWrapper(element) {
856
+ var node,
857
+ nodes = element.attributes,
858
+ index = nodes.length,
859
+ wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
860
+
861
+ // copy element attributes to the wrapper
862
+ while (index--) {
863
+ node = nodes[index];
864
+ node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
865
+ }
866
+ // copy element styles to the wrapper
867
+ wrapper.style.cssText = element.style.cssText;
868
+ return wrapper;
869
+ }
870
+
871
+ /**
872
+ * Shivs the given CSS text.
873
+ * (eg. header{} becomes html5shiv\:header{})
874
+ * @private
875
+ * @param {String} cssText The CSS text to shiv.
876
+ * @returns {String} The shived CSS text.
877
+ */
878
+ function shivCssText(cssText) {
879
+ var pair,
880
+ parts = cssText.split('{'),
881
+ index = parts.length,
882
+ reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'),
883
+ replacement = '$1' + shivNamespace + '\\:$2';
884
+
885
+ while (index--) {
886
+ pair = parts[index] = parts[index].split('}');
887
+ pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement);
888
+ parts[index] = pair.join('}');
889
+ }
890
+ return parts.join('{');
891
+ }
892
+
893
+ /**
894
+ * Removes the given wrappers, leaving the original elements.
895
+ * @private
896
+ * @params {Array} wrappers An array of printable wrappers.
897
+ */
898
+ function removeWrappers(wrappers) {
899
+ var index = wrappers.length;
900
+ while (index--) {
901
+ wrappers[index].removeNode();
902
+ }
903
+ }
904
+
905
+ /*--------------------------------------------------------------------------*/
906
+
907
+ /**
908
+ * Shivs the given document for print.
909
+ * @memberOf html5
910
+ * @param {Document} ownerDocument The document to shiv.
911
+ * @returns {Document} The shived document.
912
+ */
913
+ function shivPrint(ownerDocument) {
914
+ var shivedSheet,
915
+ wrappers,
916
+ data = getExpandoData(ownerDocument),
917
+ namespaces = ownerDocument.namespaces,
918
+ ownerWindow = ownerDocument.parentWindow;
919
+
920
+ if (!supportsShivableSheets || ownerDocument.printShived) {
921
+ return ownerDocument;
922
+ }
923
+ if (typeof namespaces[shivNamespace] == 'undefined') {
924
+ namespaces.add(shivNamespace);
925
+ }
926
+
927
+ function removeSheet() {
928
+ clearTimeout(data._removeSheetTimer);
929
+ if (shivedSheet) {
930
+ shivedSheet.removeNode(true);
931
+ }
932
+ shivedSheet= null;
933
+ }
934
+
935
+ ownerWindow.attachEvent('onbeforeprint', function() {
936
+
937
+ removeSheet();
938
+
939
+ var imports,
940
+ length,
941
+ sheet,
942
+ collection = ownerDocument.styleSheets,
943
+ cssText = [],
944
+ index = collection.length,
945
+ sheets = Array(index);
946
+
947
+ // convert styleSheets collection to an array
948
+ while (index--) {
949
+ sheets[index] = collection[index];
950
+ }
951
+ // concat all style sheet CSS text
952
+ while ((sheet = sheets.pop())) {
953
+ // IE does not enforce a same origin policy for external style sheets...
954
+ // but has trouble with some dynamically created stylesheets
955
+ if (!sheet.disabled && reMedia.test(sheet.media)) {
956
+
957
+ try {
958
+ imports = sheet.imports;
959
+ length = imports.length;
960
+ } catch(er){
961
+ length = 0;
962
+ }
963
+
964
+ for (index = 0; index < length; index++) {
965
+ sheets.push(imports[index]);
966
+ }
967
+
968
+ try {
969
+ cssText.push(sheet.cssText);
970
+ } catch(er){}
971
+ }
972
+ }
973
+
974
+ // wrap all HTML5 elements with printable elements and add the shived style sheet
975
+ cssText = shivCssText(cssText.reverse().join(''));
976
+ wrappers = addWrappers(ownerDocument);
977
+ shivedSheet = addStyleSheet(ownerDocument, cssText);
978
+
979
+ });
980
+
981
+ ownerWindow.attachEvent('onafterprint', function() {
982
+ // remove wrappers, leaving the original elements, and remove the shived style sheet
983
+ removeWrappers(wrappers);
984
+ clearTimeout(data._removeSheetTimer);
985
+ data._removeSheetTimer = setTimeout(removeSheet, 500);
986
+ });
987
+
988
+ ownerDocument.printShived = true;
989
+ return ownerDocument;
990
+ }
991
+
992
+ /*--------------------------------------------------------------------------*/
993
+
994
+ // expose API
995
+ html5.type += ' print';
996
+ html5.shivPrint = shivPrint;
997
+
998
+ // shiv for print
999
+ shivPrint(document);
1000
+
1001
+ if(typeof module == 'object' && module.exports){
1002
+ module.exports = html5;
1003
+ }
1004
+
1005
+ }(typeof window !== "undefined" ? window : this, document));
1006
+ }
1007
+
1008
+ ;
1009
+
1010
+ /**
1011
+ * contains checks to see if a string contains another string
1012
+ *
1013
+ * @access private
1014
+ * @function contains
1015
+ * @param {string} str - The string we want to check for substrings
1016
+ * @param {string} substr - The substring we want to search the first string for
1017
+ * @returns {boolean} true if and only if the first string 'str' contains the second string 'substr'
1018
+ */
1019
+ function contains(str, substr) {
1020
+ return !!~('' + str).indexOf(substr);
1021
+ }
1022
+
1023
+ ;
1024
+
1025
+ /**
1026
+ * createElement is a convenience wrapper around document.createElement. Since we
1027
+ * use createElement all over the place, this allows for (slightly) smaller code
1028
+ * as well as abstracting away issues with creating elements in contexts other than
1029
+ * HTML documents (e.g. SVG documents).
1030
+ *
1031
+ * @access private
1032
+ * @function createElement
1033
+ * @returns {HTMLElement|SVGElement} An HTML or SVG element
1034
+ */
1035
+ function createElement() {
1036
+ if (typeof document.createElement !== 'function') {
1037
+ // This is the case in IE7, where the type of createElement is "object".
1038
+ // For this reason, we cannot call apply() as Object is not a Function.
1039
+ return document.createElement(arguments[0]);
1040
+ } else if (isSVG) {
1041
+ return document.createElementNS.call(document, 'http://www.w3.org/2000/svg', arguments[0]);
1042
+ } else {
1043
+ return document.createElement.apply(document, arguments);
1044
+ }
1045
+ }
1046
+
1047
+ ;
1048
+
1049
+ /**
1050
+ * Create our "modernizr" element that we do most feature tests on.
1051
+ *
1052
+ * @access private
1053
+ */
1054
+ var modElem = {
1055
+ elem: createElement('modernizr')
1056
+ };
1057
+
1058
+ // Clean up this element
1059
+ Modernizr._q.push(function() {
1060
+ delete modElem.elem;
1061
+ });
1062
+
1063
+
1064
+
1065
+ var mStyle = {
1066
+ style: modElem.elem.style
1067
+ };
1068
+
1069
+ // kill ref for gc, must happen before mod.elem is removed, so we unshift on to
1070
+ // the front of the queue.
1071
+ Modernizr._q.unshift(function() {
1072
+ delete mStyle.style;
1073
+ });
1074
+
1075
+
1076
+
1077
+ /**
1078
+ * getBody returns the body of a document, or an element that can stand in for
1079
+ * the body if a real body does not exist
1080
+ *
1081
+ * @access private
1082
+ * @function getBody
1083
+ * @returns {HTMLElement|SVGElement} Returns the real body of a document, or an
1084
+ * artificially created element that stands in for the body
1085
+ */
1086
+ function getBody() {
1087
+ // After page load injecting a fake body doesn't work so check if body exists
1088
+ var body = document.body;
1089
+
1090
+ if (!body) {
1091
+ // Can't use the real body create a fake one.
1092
+ body = createElement(isSVG ? 'svg' : 'body');
1093
+ body.fake = true;
1094
+ }
1095
+
1096
+ return body;
1097
+ }
1098
+
1099
+ ;
1100
+
1101
+ /**
1102
+ * injectElementWithStyles injects an element with style element and some CSS rules
1103
+ *
1104
+ * @access private
1105
+ * @function injectElementWithStyles
1106
+ * @param {string} rule - String representing a css rule
1107
+ * @param {Function} callback - A function that is used to test the injected element
1108
+ * @param {number} [nodes] - An integer representing the number of additional nodes you want injected
1109
+ * @param {string[]} [testnames] - An array of strings that are used as ids for the additional nodes
1110
+ * @returns {boolean} the result of the specified callback test
1111
+ */
1112
+ function injectElementWithStyles(rule, callback, nodes, testnames) {
1113
+ var mod = 'modernizr';
1114
+ var style;
1115
+ var ret;
1116
+ var node;
1117
+ var docOverflow;
1118
+ var div = createElement('div');
1119
+ var body = getBody();
1120
+
1121
+ if (parseInt(nodes, 10)) {
1122
+ // In order not to give false positives we create a node for each test
1123
+ // This also allows the method to scale for unspecified uses
1124
+ while (nodes--) {
1125
+ node = createElement('div');
1126
+ node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
1127
+ div.appendChild(node);
1128
+ }
1129
+ }
1130
+
1131
+ style = createElement('style');
1132
+ style.type = 'text/css';
1133
+ style.id = 's' + mod;
1134
+
1135
+ // 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.
1136
+ // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270
1137
+ (!body.fake ? div : body).appendChild(style);
1138
+ body.appendChild(div);
1139
+
1140
+ if (style.styleSheet) {
1141
+ style.styleSheet.cssText = rule;
1142
+ } else {
1143
+ style.appendChild(document.createTextNode(rule));
1144
+ }
1145
+ div.id = mod;
1146
+
1147
+ if (body.fake) {
1148
+ //avoid crashing IE8, if background image is used
1149
+ body.style.background = '';
1150
+ //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible
1151
+ body.style.overflow = 'hidden';
1152
+ docOverflow = docElement.style.overflow;
1153
+ docElement.style.overflow = 'hidden';
1154
+ docElement.appendChild(body);
1155
+ }
1156
+
1157
+ ret = callback(div, rule);
1158
+ // If this is done after page load we don't want to remove the body so check if body exists
1159
+ if (body.fake && body.parentNode) {
1160
+ body.parentNode.removeChild(body);
1161
+ docElement.style.overflow = docOverflow;
1162
+ // Trigger layout so kinetic scrolling isn't disabled in iOS6+
1163
+ // eslint-disable-next-line
1164
+ docElement.offsetHeight;
1165
+ } else {
1166
+ div.parentNode.removeChild(div);
1167
+ }
1168
+
1169
+ return !!ret;
1170
+ }
1171
+
1172
+ ;
1173
+
1174
+ /**
1175
+ * domToCSS takes a camelCase string and converts it to hyphen-case
1176
+ * e.g. boxSizing -> box-sizing
1177
+ *
1178
+ * @access private
1179
+ * @function domToCSS
1180
+ * @param {string} name - String name of camelCase prop we want to convert
1181
+ * @returns {string} The hyphen-case version of the supplied name
1182
+ */
1183
+ function domToCSS(name) {
1184
+ return name.replace(/([A-Z])/g, function(str, m1) {
1185
+ return '-' + m1.toLowerCase();
1186
+ }).replace(/^ms-/, '-ms-');
1187
+ }
1188
+
1189
+ ;
1190
+
1191
+
1192
+ /**
1193
+ * wrapper around getComputedStyle, to fix issues with Firefox returning null when
1194
+ * called inside of a hidden iframe
1195
+ *
1196
+ * @access private
1197
+ * @function computedStyle
1198
+ * @param {HTMLElement|SVGElement} elem - The element we want to find the computed styles of
1199
+ * @param {string|null} [pseudo] - An optional pseudo element selector (e.g. :before), of null if none
1200
+ * @param {string} prop - A CSS property
1201
+ * @returns {CSSStyleDeclaration} the value of the specified CSS property
1202
+ */
1203
+ function computedStyle(elem, pseudo, prop) {
1204
+ var result;
1205
+
1206
+ if ('getComputedStyle' in window) {
1207
+ result = getComputedStyle.call(window, elem, pseudo);
1208
+ var console = window.console;
1209
+
1210
+ if (result !== null) {
1211
+ if (prop) {
1212
+ result = result.getPropertyValue(prop);
1213
+ }
1214
+ } else {
1215
+ if (console) {
1216
+ var method = console.error ? 'error' : 'log';
1217
+ console[method].call(console, 'getComputedStyle returning null, its possible modernizr test results are inaccurate');
1218
+ }
1219
+ }
1220
+ } else {
1221
+ result = !pseudo && elem.currentStyle && elem.currentStyle[prop];
1222
+ }
1223
+
1224
+ return result;
1225
+ }
1226
+
1227
+ ;
1228
+
1229
+ /**
1230
+ * nativeTestProps allows for us to use native feature detection functionality if available.
1231
+ * some prefixed form, or false, in the case of an unsupported rule
1232
+ *
1233
+ * @access private
1234
+ * @function nativeTestProps
1235
+ * @param {Array} props - An array of property names
1236
+ * @param {string} value - A string representing the value we want to check via @supports
1237
+ * @returns {boolean|undefined} A boolean when @supports exists, undefined otherwise
1238
+ */
1239
+ // Accepts a list of property names and a single value
1240
+ // Returns `undefined` if native detection not available
1241
+ function nativeTestProps(props, value) {
1242
+ var i = props.length;
1243
+ // Start with the JS API: https://www.w3.org/TR/css3-conditional/#the-css-interface
1244
+ if ('CSS' in window && 'supports' in window.CSS) {
1245
+ // Try every prefixed variant of the property
1246
+ while (i--) {
1247
+ if (window.CSS.supports(domToCSS(props[i]), value)) {
1248
+ return true;
1249
+ }
1250
+ }
1251
+ return false;
1252
+ }
1253
+ // Otherwise fall back to at-rule (for Opera 12.x)
1254
+ else if ('CSSSupportsRule' in window) {
1255
+ // Build a condition string for every prefixed variant
1256
+ var conditionText = [];
1257
+ while (i--) {
1258
+ conditionText.push('(' + domToCSS(props[i]) + ':' + value + ')');
1259
+ }
1260
+ conditionText = conditionText.join(' or ');
1261
+ return injectElementWithStyles('@supports (' + conditionText + ') { #modernizr { position: absolute; } }', function(node) {
1262
+ return computedStyle(node, null, 'position') === 'absolute';
1263
+ });
1264
+ }
1265
+ return undefined;
1266
+ }
1267
+ ;
1268
+
1269
+ /**
1270
+ * cssToDOM takes a hyphen-case string and converts it to camelCase
1271
+ * e.g. box-sizing -> boxSizing
1272
+ *
1273
+ * @access private
1274
+ * @function cssToDOM
1275
+ * @param {string} name - String name of hyphen-case prop we want to convert
1276
+ * @returns {string} The camelCase version of the supplied name
1277
+ */
1278
+ function cssToDOM(name) {
1279
+ return name.replace(/([a-z])-([a-z])/g, function(str, m1, m2) {
1280
+ return m1 + m2.toUpperCase();
1281
+ }).replace(/^-/, '');
1282
+ }
1283
+
1284
+ ;
1285
+
1286
+ // testProps is a generic CSS / DOM property test.
1287
+
1288
+ // In testing support for a given CSS property, it's legit to test:
1289
+ // `elem.style[styleName] !== undefined`
1290
+ // If the property is supported it will return an empty string,
1291
+ // if unsupported it will return undefined.
1292
+
1293
+ // We'll take advantage of this quick test and skip setting a style
1294
+ // on our modernizr element, but instead just testing undefined vs
1295
+ // empty string.
1296
+
1297
+ // Property names can be provided in either camelCase or hyphen-case.
1298
+
1299
+ function testProps(props, prefixed, value, skipValueTest) {
1300
+ skipValueTest = is(skipValueTest, 'undefined') ? false : skipValueTest;
1301
+
1302
+ // Try native detect first
1303
+ if (!is(value, 'undefined')) {
1304
+ var result = nativeTestProps(props, value);
1305
+ if (!is(result, 'undefined')) {
1306
+ return result;
1307
+ }
1308
+ }
1309
+
1310
+ // Otherwise do it properly
1311
+ var afterInit, i, propsLength, prop, before;
1312
+
1313
+ // If we don't have a style element, that means we're running async or after
1314
+ // the core tests, so we'll need to create our own elements to use.
1315
+
1316
+ // Inside of an SVG element, in certain browsers, the `style` element is only
1317
+ // defined for valid tags. Therefore, if `modernizr` does not have one, we
1318
+ // fall back to a less used element and hope for the best.
1319
+ // For strict XHTML browsers the hardly used samp element is used.
1320
+ var elems = ['modernizr', 'tspan', 'samp'];
1321
+ while (!mStyle.style && elems.length) {
1322
+ afterInit = true;
1323
+ mStyle.modElem = createElement(elems.shift());
1324
+ mStyle.style = mStyle.modElem.style;
1325
+ }
1326
+
1327
+ // Delete the objects if we created them.
1328
+ function cleanElems() {
1329
+ if (afterInit) {
1330
+ delete mStyle.style;
1331
+ delete mStyle.modElem;
1332
+ }
1333
+ }
1334
+
1335
+ propsLength = props.length;
1336
+ for (i = 0; i < propsLength; i++) {
1337
+ prop = props[i];
1338
+ before = mStyle.style[prop];
1339
+
1340
+ if (contains(prop, '-')) {
1341
+ prop = cssToDOM(prop);
1342
+ }
1343
+
1344
+ if (mStyle.style[prop] !== undefined) {
1345
+
1346
+ // If value to test has been passed in, do a set-and-check test.
1347
+ // 0 (integer) is a valid property value, so check that `value` isn't
1348
+ // undefined, rather than just checking it's truthy.
1349
+ if (!skipValueTest && !is(value, 'undefined')) {
1350
+
1351
+ // Needs a try catch block because of old IE. This is slow, but will
1352
+ // be avoided in most cases because `skipValueTest` will be used.
1353
+ try {
1354
+ mStyle.style[prop] = value;
1355
+ } catch (e) {}
1356
+
1357
+ // If the property value has changed, we assume the value used is
1358
+ // supported. If `value` is empty string, it'll fail here (because
1359
+ // it hasn't changed), which matches how browsers have implemented
1360
+ // CSS.supports()
1361
+ if (mStyle.style[prop] !== before) {
1362
+ cleanElems();
1363
+ return prefixed === 'pfx' ? prop : true;
1364
+ }
1365
+ }
1366
+ // Otherwise just return true, or the property name if this is a
1367
+ // `prefixed()` call
1368
+ else {
1369
+ cleanElems();
1370
+ return prefixed === 'pfx' ? prop : true;
1371
+ }
1372
+ }
1373
+ }
1374
+ cleanElems();
1375
+ return false;
1376
+ }
1377
+
1378
+ ;
1379
+
1380
+ /**
1381
+ * testProp() investigates whether a given style property is recognized
1382
+ * Property names can be provided in either camelCase or hyphen-case.
1383
+ *
1384
+ * @memberOf Modernizr
1385
+ * @name Modernizr.testProp
1386
+ * @access public
1387
+ * @optionName Modernizr.testProp()
1388
+ * @optionProp testProp
1389
+ * @function testProp
1390
+ * @param {string} prop - Name of the CSS property to check
1391
+ * @param {string} [value] - Name of the CSS value to check
1392
+ * @param {boolean} [useValue] - Whether or not to check the value if @supports isn't supported
1393
+ * @returns {boolean} an empty string if the property is supported, undefined if its unsupported
1394
+ * @example
1395
+ *
1396
+ * Just like [testAllProps](#modernizr-testallprops), only it does not check any vendor prefixed
1397
+ * version of the string.
1398
+ *
1399
+ * Note that the property name must be provided in camelCase (e.g. boxSizing not box-sizing)
1400
+ *
1401
+ * ```js
1402
+ * Modernizr.testProp('pointerEvents') // true
1403
+ * ```
1404
+ *
1405
+ * You can also provide a value as an optional second argument to check if a
1406
+ * specific value is supported
1407
+ *
1408
+ * ```js
1409
+ * Modernizr.testProp('pointerEvents', 'none') // true
1410
+ * Modernizr.testProp('pointerEvents', 'penguin') // false
1411
+ * ```
1412
+ */
1413
+ var testProp = ModernizrProto.testProp = function(prop, value, useValue) {
1414
+ return testProps([prop], undefined, value, useValue);
1415
+ };
1416
+
1417
+
1418
+ /*!
1419
+ {
1420
+ "name": "Cross-Origin Resource Sharing",
1421
+ "property": "cors",
1422
+ "caniuse": "cors",
1423
+ "authors": ["Theodoor van Donge"],
1424
+ "notes": [{
1425
+ "name": "MDN Docs",
1426
+ "href": "https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS"
1427
+ }],
1428
+ "polyfills": ["pmxdr", "ppx", "flxhr"]
1429
+ }
1430
+ !*/
1431
+ /* DOC
1432
+ Detects support for Cross-Origin Resource Sharing: method of performing XMLHttpRequests across domains.
1433
+ */
1434
+
1435
+ Modernizr.addTest('cors', 'XMLHttpRequest' in window && 'withCredentials' in new XMLHttpRequest());
1436
+
1437
+
1438
+ /**
1439
+ * since we have a fairly large number of input tests that don't mutate the input
1440
+ * we create a single element that can be shared with all of those tests for a
1441
+ * minor perf boost
1442
+ *
1443
+ * @access private
1444
+ * @returns {HTMLInputElement}
1445
+ */
1446
+ var inputElem = createElement('input');
1447
+
1448
+ /*!
1449
+ {
1450
+ "name": "Input attributes",
1451
+ "property": "input",
1452
+ "tags": ["forms"],
1453
+ "authors": ["Mike Taylor"],
1454
+ "notes": [{
1455
+ "name": "WHATWG Spec",
1456
+ "href": "https://html.spec.whatwg.org/multipage/input.html#input-type-attr-summary"
1457
+ }],
1458
+ "knownBugs": ["Some blackberry devices report false positive for input.multiple"]
1459
+ }
1460
+ !*/
1461
+ /* DOC
1462
+ Detects support for HTML5 `<input>` element attributes and exposes Boolean subproperties with the results:
1463
+
1464
+ ```javascript
1465
+ Modernizr.input.autocomplete
1466
+ Modernizr.input.autofocus
1467
+ Modernizr.input.list
1468
+ Modernizr.input.max
1469
+ Modernizr.input.min
1470
+ Modernizr.input.multiple
1471
+ Modernizr.input.pattern
1472
+ Modernizr.input.placeholder
1473
+ Modernizr.input.required
1474
+ Modernizr.input.step
1475
+ ```
1476
+ */
1477
+
1478
+ // Run through HTML5's new input attributes to see if the UA understands any.
1479
+ // Mike Taylr has created a comprehensive resource for testing these attributes
1480
+ // when applied to all input types:
1481
+ // miketaylr.com/code/input-type-attr.html
1482
+
1483
+ // Only input placeholder is tested while textarea's placeholder is not.
1484
+ // Currently Safari 4 and Opera 11 have support only for the input placeholder
1485
+ // Both tests are available in feature-detects/forms-placeholder.js
1486
+
1487
+ var inputattrs = 'autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ');
1488
+ var attrs = {};
1489
+
1490
+ Modernizr.input = (function(props) {
1491
+ for (var i = 0, len = props.length; i < len; i++) {
1492
+ attrs[ props[i] ] = !!(props[i] in inputElem);
1493
+ }
1494
+ if (attrs.list) {
1495
+ // safari false positive's on datalist: webk.it/74252
1496
+ // see also github.com/Modernizr/Modernizr/issues/146
1497
+ attrs.list = !!(createElement('datalist') && window.HTMLDataListElement);
1498
+ }
1499
+ return attrs;
1500
+ })(inputattrs);
1501
+
1502
+
1503
+ /**
1504
+ * Object.prototype.toString can be used with every object and allows you to
1505
+ * get its class easily. Abstracting it off of an object prevents situations
1506
+ * where the toString property has been overridden
1507
+ *
1508
+ * @access private
1509
+ * @function toStringFn
1510
+ * @returns {Function} An abstracted toString function
1511
+ */
1512
+ var toStringFn = ({}).toString;
1513
+
1514
+ /*!
1515
+ {
1516
+ "name": "SVG SMIL animation",
1517
+ "property": "smil",
1518
+ "caniuse": "svg-smil",
1519
+ "tags": ["svg"],
1520
+ "notes": [{
1521
+ "name": "W3C Spec",
1522
+ "href": "https://www.w3.org/AudioVideo/"
1523
+ }]
1524
+ }
1525
+ !*/
1526
+
1527
+ // SVG SMIL animation
1528
+ Modernizr.addTest('smil', function() {
1529
+ return !!document.createElementNS &&
1530
+ /SVGAnimate/.test(toStringFn.call(document.createElementNS('http://www.w3.org/2000/svg', 'animate')));
1531
+ });
1532
+
1533
+
1534
+ // Run each test
1535
+ testRunner();
1536
+
1537
+ // Remove the "no-js" class if it exists
1538
+ setClasses(classes);
1539
+
1540
+ delete ModernizrProto.addTest;
1541
+ delete ModernizrProto.addAsyncTest;
1542
+
1543
+ // Run the things that are supposed to run after the tests
1544
+ for (var i = 0; i < Modernizr._q.length; i++) {
1545
+ Modernizr._q[i]();
1546
+ }
1547
+
1548
+ // Leak Modernizr namespace
1549
+ scriptGlobalObject.Modernizr = Modernizr;
1550
+
1551
+
1552
+ ;
1553
+
1554
+ })(window, window, document);