1
|
/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
|
2
|
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
|
3
|
*/
|
4
|
;
|
5
|
|
6
|
|
7
|
|
8
|
window.Modernizr = (function( window, document, undefined ) {
|
9
|
|
10
|
var version = '2.8.3',
|
11
|
|
12
|
Modernizr = {},
|
13
|
|
14
|
enableClasses = true,
|
15
|
|
16
|
docElement = document.documentElement,
|
17
|
|
18
|
mod = 'modernizr',
|
19
|
modElem = document.createElement(mod),
|
20
|
mStyle = modElem.style,
|
21
|
|
22
|
inputElem = document.createElement('input') ,
|
23
|
|
24
|
smile = ':)',
|
25
|
|
26
|
toString = {}.toString,
|
27
|
|
28
|
prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
|
29
|
|
30
|
|
31
|
|
32
|
omPrefixes = 'Webkit Moz O ms',
|
33
|
|
34
|
cssomPrefixes = omPrefixes.split(' '),
|
35
|
|
36
|
domPrefixes = omPrefixes.toLowerCase().split(' '),
|
37
|
|
38
|
ns = {'svg': 'http://www.w3.org/2000/svg'},
|
39
|
|
40
|
tests = {},
|
41
|
inputs = {},
|
42
|
attrs = {},
|
43
|
|
44
|
classes = [],
|
45
|
|
46
|
slice = classes.slice,
|
47
|
|
48
|
featureName,
|
49
|
|
50
|
|
51
|
injectElementWithStyles = function( rule, callback, nodes, testnames ) {
|
52
|
|
53
|
var style, ret, node, docOverflow,
|
54
|
div = document.createElement('div'),
|
55
|
body = document.body,
|
56
|
fakeBody = body || document.createElement('body');
|
57
|
|
58
|
if ( parseInt(nodes, 10) ) {
|
59
|
while ( nodes-- ) {
|
60
|
node = document.createElement('div');
|
61
|
node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
|
62
|
div.appendChild(node);
|
63
|
}
|
64
|
}
|
65
|
|
66
|
style = ['­','<style id="s', mod, '">', rule, '</style>'].join('');
|
67
|
div.id = mod;
|
68
|
(body ? div : fakeBody).innerHTML += style;
|
69
|
fakeBody.appendChild(div);
|
70
|
if ( !body ) {
|
71
|
fakeBody.style.background = '';
|
72
|
fakeBody.style.overflow = 'hidden';
|
73
|
docOverflow = docElement.style.overflow;
|
74
|
docElement.style.overflow = 'hidden';
|
75
|
docElement.appendChild(fakeBody);
|
76
|
}
|
77
|
|
78
|
ret = callback(div, rule);
|
79
|
if ( !body ) {
|
80
|
fakeBody.parentNode.removeChild(fakeBody);
|
81
|
docElement.style.overflow = docOverflow;
|
82
|
} else {
|
83
|
div.parentNode.removeChild(div);
|
84
|
}
|
85
|
|
86
|
return !!ret;
|
87
|
|
88
|
},
|
89
|
|
90
|
testMediaQuery = function( mq ) {
|
91
|
|
92
|
var matchMedia = window.matchMedia || window.msMatchMedia;
|
93
|
if ( matchMedia ) {
|
94
|
return matchMedia(mq) && matchMedia(mq).matches || false;
|
95
|
}
|
96
|
|
97
|
var bool;
|
98
|
|
99
|
injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {
|
100
|
bool = (window.getComputedStyle ?
|
101
|
getComputedStyle(node, null) :
|
102
|
node.currentStyle)['position'] == 'absolute';
|
103
|
});
|
104
|
|
105
|
return bool;
|
106
|
|
107
|
},
|
108
|
|
109
|
|
110
|
isEventSupported = (function() {
|
111
|
|
112
|
var TAGNAMES = {
|
113
|
'select': 'input', 'change': 'input',
|
114
|
'submit': 'form', 'reset': 'form',
|
115
|
'error': 'img', 'load': 'img', 'abort': 'img'
|
116
|
};
|
117
|
|
118
|
function isEventSupported( eventName, element ) {
|
119
|
|
120
|
element = element || document.createElement(TAGNAMES[eventName] || 'div');
|
121
|
eventName = 'on' + eventName;
|
122
|
|
123
|
var isSupported = eventName in element;
|
124
|
|
125
|
if ( !isSupported ) {
|
126
|
if ( !element.setAttribute ) {
|
127
|
element = document.createElement('div');
|
128
|
}
|
129
|
if ( element.setAttribute && element.removeAttribute ) {
|
130
|
element.setAttribute(eventName, '');
|
131
|
isSupported = is(element[eventName], 'function');
|
132
|
|
133
|
if ( !is(element[eventName], 'undefined') ) {
|
134
|
element[eventName] = undefined;
|
135
|
}
|
136
|
element.removeAttribute(eventName);
|
137
|
}
|
138
|
}
|
139
|
|
140
|
element = null;
|
141
|
return isSupported;
|
142
|
}
|
143
|
return isEventSupported;
|
144
|
})(),
|
145
|
|
146
|
|
147
|
_hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
|
148
|
|
149
|
if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
|
150
|
hasOwnProp = function (object, property) {
|
151
|
return _hasOwnProperty.call(object, property);
|
152
|
};
|
153
|
}
|
154
|
else {
|
155
|
hasOwnProp = function (object, property) {
|
156
|
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
|
157
|
};
|
158
|
}
|
159
|
|
160
|
|
161
|
if (!Function.prototype.bind) {
|
162
|
Function.prototype.bind = function bind(that) {
|
163
|
|
164
|
var target = this;
|
165
|
|
166
|
if (typeof target != "function") {
|
167
|
throw new TypeError();
|
168
|
}
|
169
|
|
170
|
var args = slice.call(arguments, 1),
|
171
|
bound = function () {
|
172
|
|
173
|
if (this instanceof bound) {
|
174
|
|
175
|
var F = function(){};
|
176
|
F.prototype = target.prototype;
|
177
|
var self = new F();
|
178
|
|
179
|
var result = target.apply(
|
180
|
self,
|
181
|
args.concat(slice.call(arguments))
|
182
|
);
|
183
|
if (Object(result) === result) {
|
184
|
return result;
|
185
|
}
|
186
|
return self;
|
187
|
|
188
|
} else {
|
189
|
|
190
|
return target.apply(
|
191
|
that,
|
192
|
args.concat(slice.call(arguments))
|
193
|
);
|
194
|
|
195
|
}
|
196
|
|
197
|
};
|
198
|
|
199
|
return bound;
|
200
|
};
|
201
|
}
|
202
|
|
203
|
function setCss( str ) {
|
204
|
mStyle.cssText = str;
|
205
|
}
|
206
|
|
207
|
function setCssAll( str1, str2 ) {
|
208
|
return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
|
209
|
}
|
210
|
|
211
|
function is( obj, type ) {
|
212
|
return typeof obj === type;
|
213
|
}
|
214
|
|
215
|
function contains( str, substr ) {
|
216
|
return !!~('' + str).indexOf(substr);
|
217
|
}
|
218
|
|
219
|
function testProps( props, prefixed ) {
|
220
|
for ( var i in props ) {
|
221
|
var prop = props[i];
|
222
|
if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
|
223
|
return prefixed == 'pfx' ? prop : true;
|
224
|
}
|
225
|
}
|
226
|
return false;
|
227
|
}
|
228
|
|
229
|
function testDOMProps( props, obj, elem ) {
|
230
|
for ( var i in props ) {
|
231
|
var item = obj[props[i]];
|
232
|
if ( item !== undefined) {
|
233
|
|
234
|
if (elem === false) return props[i];
|
235
|
|
236
|
if (is(item, 'function')){
|
237
|
return item.bind(elem || obj);
|
238
|
}
|
239
|
|
240
|
return item;
|
241
|
}
|
242
|
}
|
243
|
return false;
|
244
|
}
|
245
|
|
246
|
function testPropsAll( prop, prefixed, elem ) {
|
247
|
|
248
|
var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1),
|
249
|
props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
|
250
|
|
251
|
if(is(prefixed, "string") || is(prefixed, "undefined")) {
|
252
|
return testProps(props, prefixed);
|
253
|
|
254
|
} else {
|
255
|
props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
|
256
|
return testDOMProps(props, prefixed, elem);
|
257
|
}
|
258
|
} tests['flexbox'] = function() {
|
259
|
return testPropsAll('flexWrap');
|
260
|
}; tests['canvas'] = function() {
|
261
|
var elem = document.createElement('canvas');
|
262
|
return !!(elem.getContext && elem.getContext('2d'));
|
263
|
};
|
264
|
|
265
|
tests['canvastext'] = function() {
|
266
|
return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
|
267
|
};
|
268
|
|
269
|
|
270
|
|
271
|
tests['webgl'] = function() {
|
272
|
return !!window.WebGLRenderingContext;
|
273
|
};
|
274
|
|
275
|
|
276
|
tests['touch'] = function() {
|
277
|
var bool;
|
278
|
|
279
|
if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
|
280
|
bool = true;
|
281
|
} else {
|
282
|
injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
|
283
|
bool = node.offsetTop === 9;
|
284
|
});
|
285
|
}
|
286
|
|
287
|
return bool;
|
288
|
};
|
289
|
|
290
|
|
291
|
|
292
|
tests['geolocation'] = function() {
|
293
|
return 'geolocation' in navigator;
|
294
|
};
|
295
|
|
296
|
|
297
|
tests['postmessage'] = function() {
|
298
|
return !!window.postMessage;
|
299
|
};
|
300
|
|
301
|
|
302
|
tests['websqldatabase'] = function() {
|
303
|
return !!window.openDatabase;
|
304
|
};
|
305
|
|
306
|
tests['indexedDB'] = function() {
|
307
|
return !!testPropsAll("indexedDB", window);
|
308
|
};
|
309
|
|
310
|
tests['hashchange'] = function() {
|
311
|
return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);
|
312
|
};
|
313
|
|
314
|
tests['history'] = function() {
|
315
|
return !!(window.history && history.pushState);
|
316
|
};
|
317
|
|
318
|
tests['draganddrop'] = function() {
|
319
|
var div = document.createElement('div');
|
320
|
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
|
321
|
};
|
322
|
|
323
|
tests['websockets'] = function() {
|
324
|
return 'WebSocket' in window || 'MozWebSocket' in window;
|
325
|
};
|
326
|
|
327
|
|
328
|
tests['rgba'] = function() {
|
329
|
setCss('background-color:rgba(150,255,150,.5)');
|
330
|
|
331
|
return contains(mStyle.backgroundColor, 'rgba');
|
332
|
};
|
333
|
|
334
|
tests['hsla'] = function() {
|
335
|
setCss('background-color:hsla(120,40%,100%,.5)');
|
336
|
|
337
|
return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');
|
338
|
};
|
339
|
|
340
|
tests['multiplebgs'] = function() {
|
341
|
setCss('background:url(https://),url(https://),red url(https://)');
|
342
|
|
343
|
return (/(url\s*\(.*?){3}/).test(mStyle.background);
|
344
|
}; tests['backgroundsize'] = function() {
|
345
|
return testPropsAll('backgroundSize');
|
346
|
};
|
347
|
|
348
|
tests['borderimage'] = function() {
|
349
|
return testPropsAll('borderImage');
|
350
|
};
|
351
|
|
352
|
|
353
|
|
354
|
tests['borderradius'] = function() {
|
355
|
return testPropsAll('borderRadius');
|
356
|
};
|
357
|
|
358
|
tests['boxshadow'] = function() {
|
359
|
return testPropsAll('boxShadow');
|
360
|
};
|
361
|
|
362
|
tests['textshadow'] = function() {
|
363
|
return document.createElement('div').style.textShadow === '';
|
364
|
};
|
365
|
|
366
|
|
367
|
tests['opacity'] = function() {
|
368
|
setCssAll('opacity:.55');
|
369
|
|
370
|
return (/^0.55$/).test(mStyle.opacity);
|
371
|
};
|
372
|
|
373
|
|
374
|
tests['cssanimations'] = function() {
|
375
|
return testPropsAll('animationName');
|
376
|
};
|
377
|
|
378
|
|
379
|
tests['csscolumns'] = function() {
|
380
|
return testPropsAll('columnCount');
|
381
|
};
|
382
|
|
383
|
|
384
|
tests['cssgradients'] = function() {
|
385
|
var str1 = 'background-image:',
|
386
|
str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
|
387
|
str3 = 'linear-gradient(left top,#9f9, white);';
|
388
|
|
389
|
setCss(
|
390
|
(str1 + '-webkit- '.split(' ').join(str2 + str1) +
|
391
|
prefixes.join(str3 + str1)).slice(0, -str1.length)
|
392
|
);
|
393
|
|
394
|
return contains(mStyle.backgroundImage, 'gradient');
|
395
|
};
|
396
|
|
397
|
|
398
|
tests['cssreflections'] = function() {
|
399
|
return testPropsAll('boxReflect');
|
400
|
};
|
401
|
|
402
|
|
403
|
tests['csstransforms'] = function() {
|
404
|
return !!testPropsAll('transform');
|
405
|
};
|
406
|
|
407
|
|
408
|
tests['csstransforms3d'] = function() {
|
409
|
|
410
|
var ret = !!testPropsAll('perspective');
|
411
|
|
412
|
if ( ret && 'webkitPerspective' in docElement.style ) {
|
413
|
|
414
|
injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
|
415
|
ret = node.offsetLeft === 9 && node.offsetHeight === 3;
|
416
|
});
|
417
|
}
|
418
|
return ret;
|
419
|
};
|
420
|
|
421
|
|
422
|
tests['csstransitions'] = function() {
|
423
|
return testPropsAll('transition');
|
424
|
};
|
425
|
|
426
|
|
427
|
|
428
|
tests['fontface'] = function() {
|
429
|
var bool;
|
430
|
|
431
|
injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
|
432
|
var style = document.getElementById('smodernizr'),
|
433
|
sheet = style.sheet || style.styleSheet,
|
434
|
cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
|
435
|
|
436
|
bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
|
437
|
});
|
438
|
|
439
|
return bool;
|
440
|
};
|
441
|
|
442
|
tests['generatedcontent'] = function() {
|
443
|
var bool;
|
444
|
|
445
|
injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
|
446
|
bool = node.offsetHeight >= 3;
|
447
|
});
|
448
|
|
449
|
return bool;
|
450
|
};
|
451
|
tests['video'] = function() {
|
452
|
var elem = document.createElement('video'),
|
453
|
bool = false;
|
454
|
|
455
|
try {
|
456
|
if ( bool = !!elem.canPlayType ) {
|
457
|
bool = new Boolean(bool);
|
458
|
bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,'');
|
459
|
|
460
|
bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
|
461
|
|
462
|
bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
|
463
|
}
|
464
|
|
465
|
} catch(e) { }
|
466
|
|
467
|
return bool;
|
468
|
};
|
469
|
|
470
|
tests['audio'] = function() {
|
471
|
var elem = document.createElement('audio'),
|
472
|
bool = false;
|
473
|
|
474
|
try {
|
475
|
if ( bool = !!elem.canPlayType ) {
|
476
|
bool = new Boolean(bool);
|
477
|
bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
|
478
|
bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,'');
|
479
|
|
480
|
bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,'');
|
481
|
bool.m4a = ( elem.canPlayType('audio/x-m4a;') ||
|
482
|
elem.canPlayType('audio/aac;')) .replace(/^no$/,'');
|
483
|
}
|
484
|
} catch(e) { }
|
485
|
|
486
|
return bool;
|
487
|
};
|
488
|
|
489
|
|
490
|
tests['localstorage'] = function() {
|
491
|
try {
|
492
|
localStorage.setItem(mod, mod);
|
493
|
localStorage.removeItem(mod);
|
494
|
return true;
|
495
|
} catch(e) {
|
496
|
return false;
|
497
|
}
|
498
|
};
|
499
|
|
500
|
tests['sessionstorage'] = function() {
|
501
|
try {
|
502
|
sessionStorage.setItem(mod, mod);
|
503
|
sessionStorage.removeItem(mod);
|
504
|
return true;
|
505
|
} catch(e) {
|
506
|
return false;
|
507
|
}
|
508
|
};
|
509
|
|
510
|
|
511
|
tests['webworkers'] = function() {
|
512
|
return !!window.Worker;
|
513
|
};
|
514
|
|
515
|
|
516
|
tests['applicationcache'] = function() {
|
517
|
return !!window.applicationCache;
|
518
|
};
|
519
|
|
520
|
|
521
|
tests['svg'] = function() {
|
522
|
return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
|
523
|
};
|
524
|
|
525
|
tests['inlinesvg'] = function() {
|
526
|
var div = document.createElement('div');
|
527
|
div.innerHTML = '<svg/>';
|
528
|
return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
|
529
|
};
|
530
|
|
531
|
tests['smil'] = function() {
|
532
|
return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));
|
533
|
};
|
534
|
|
535
|
|
536
|
tests['svgclippaths'] = function() {
|
537
|
return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
|
538
|
};
|
539
|
|
540
|
function webforms() {
|
541
|
Modernizr['input'] = (function( props ) {
|
542
|
for ( var i = 0, len = props.length; i < len; i++ ) {
|
543
|
attrs[ props[i] ] = !!(props[i] in inputElem);
|
544
|
}
|
545
|
if (attrs.list){
|
546
|
attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
|
547
|
}
|
548
|
return attrs;
|
549
|
})('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
|
550
|
Modernizr['inputtypes'] = (function(props) {
|
551
|
|
552
|
for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
|
553
|
|
554
|
inputElem.setAttribute('type', inputElemType = props[i]);
|
555
|
bool = inputElem.type !== 'text';
|
556
|
|
557
|
if ( bool ) {
|
558
|
|
559
|
inputElem.value = smile;
|
560
|
inputElem.style.cssText = 'position:absolute;visibility:hidden;';
|
561
|
|
562
|
if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
|
563
|
|
564
|
docElement.appendChild(inputElem);
|
565
|
defaultView = document.defaultView;
|
566
|
|
567
|
bool = defaultView.getComputedStyle &&
|
568
|
defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
|
569
|
(inputElem.offsetHeight !== 0);
|
570
|
|
571
|
docElement.removeChild(inputElem);
|
572
|
|
573
|
} else if ( /^(search|tel)$/.test(inputElemType) ){
|
574
|
} else if ( /^(url|email)$/.test(inputElemType) ) {
|
575
|
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
|
576
|
|
577
|
} else {
|
578
|
bool = inputElem.value != smile;
|
579
|
}
|
580
|
}
|
581
|
|
582
|
inputs[ props[i] ] = !!bool;
|
583
|
}
|
584
|
return inputs;
|
585
|
})('search tel url email datetime date month week time datetime-local number range color'.split(' '));
|
586
|
}
|
587
|
for ( var feature in tests ) {
|
588
|
if ( hasOwnProp(tests, feature) ) {
|
589
|
featureName = feature.toLowerCase();
|
590
|
Modernizr[featureName] = tests[feature]();
|
591
|
|
592
|
classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
|
593
|
}
|
594
|
}
|
595
|
|
596
|
Modernizr.input || webforms();
|
597
|
|
598
|
|
599
|
Modernizr.addTest = function ( feature, test ) {
|
600
|
if ( typeof feature == 'object' ) {
|
601
|
for ( var key in feature ) {
|
602
|
if ( hasOwnProp( feature, key ) ) {
|
603
|
Modernizr.addTest( key, feature[ key ] );
|
604
|
}
|
605
|
}
|
606
|
} else {
|
607
|
|
608
|
feature = feature.toLowerCase();
|
609
|
|
610
|
if ( Modernizr[feature] !== undefined ) {
|
611
|
return Modernizr;
|
612
|
}
|
613
|
|
614
|
test = typeof test == 'function' ? test() : test;
|
615
|
|
616
|
if (typeof enableClasses !== "undefined" && enableClasses) {
|
617
|
docElement.className += ' ' + (test ? '' : 'no-') + feature;
|
618
|
}
|
619
|
Modernizr[feature] = test;
|
620
|
|
621
|
}
|
622
|
|
623
|
return Modernizr;
|
624
|
};
|
625
|
|
626
|
|
627
|
setCss('');
|
628
|
modElem = inputElem = null;
|
629
|
|
630
|
;(function(window, document) {
|
631
|
var version = '3.7.0';
|
632
|
|
633
|
var options = window.html5 || {};
|
634
|
|
635
|
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
636
|
|
637
|
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;
|
638
|
|
639
|
var supportsHtml5Styles;
|
640
|
|
641
|
var expando = '_html5shiv';
|
642
|
|
643
|
var expanID = 0;
|
644
|
|
645
|
var expandoData = {};
|
646
|
|
647
|
var supportsUnknownElements;
|
648
|
|
649
|
(function() {
|
650
|
try {
|
651
|
var a = document.createElement('a');
|
652
|
a.innerHTML = '<xyz></xyz>';
|
653
|
supportsHtml5Styles = ('hidden' in a);
|
654
|
|
655
|
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
656
|
(document.createElement)('a');
|
657
|
var frag = document.createDocumentFragment();
|
658
|
return (
|
659
|
typeof frag.cloneNode == 'undefined' ||
|
660
|
typeof frag.createDocumentFragment == 'undefined' ||
|
661
|
typeof frag.createElement == 'undefined'
|
662
|
);
|
663
|
}());
|
664
|
} catch(e) {
|
665
|
supportsHtml5Styles = true;
|
666
|
supportsUnknownElements = true;
|
667
|
}
|
668
|
|
669
|
}());
|
670
|
|
671
|
function addStyleSheet(ownerDocument, cssText) {
|
672
|
var p = ownerDocument.createElement('p'),
|
673
|
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
674
|
|
675
|
p.innerHTML = 'x<style>' + cssText + '</style>';
|
676
|
return parent.insertBefore(p.lastChild, parent.firstChild);
|
677
|
}
|
678
|
|
679
|
function getElements() {
|
680
|
var elements = html5.elements;
|
681
|
return typeof elements == 'string' ? elements.split(' ') : elements;
|
682
|
}
|
683
|
|
684
|
function getExpandoData(ownerDocument) {
|
685
|
var data = expandoData[ownerDocument[expando]];
|
686
|
if (!data) {
|
687
|
data = {};
|
688
|
expanID++;
|
689
|
ownerDocument[expando] = expanID;
|
690
|
expandoData[expanID] = data;
|
691
|
}
|
692
|
return data;
|
693
|
}
|
694
|
|
695
|
function createElement(nodeName, ownerDocument, data){
|
696
|
if (!ownerDocument) {
|
697
|
ownerDocument = document;
|
698
|
}
|
699
|
if(supportsUnknownElements){
|
700
|
return ownerDocument.createElement(nodeName);
|
701
|
}
|
702
|
if (!data) {
|
703
|
data = getExpandoData(ownerDocument);
|
704
|
}
|
705
|
var node;
|
706
|
|
707
|
if (data.cache[nodeName]) {
|
708
|
node = data.cache[nodeName].cloneNode();
|
709
|
} else if (saveClones.test(nodeName)) {
|
710
|
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
711
|
} else {
|
712
|
node = data.createElem(nodeName);
|
713
|
}
|
714
|
|
715
|
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
716
|
}
|
717
|
|
718
|
function createDocumentFragment(ownerDocument, data){
|
719
|
if (!ownerDocument) {
|
720
|
ownerDocument = document;
|
721
|
}
|
722
|
if(supportsUnknownElements){
|
723
|
return ownerDocument.createDocumentFragment();
|
724
|
}
|
725
|
data = data || getExpandoData(ownerDocument);
|
726
|
var clone = data.frag.cloneNode(),
|
727
|
i = 0,
|
728
|
elems = getElements(),
|
729
|
l = elems.length;
|
730
|
for(;i<l;i++){
|
731
|
clone.createElement(elems[i]);
|
732
|
}
|
733
|
return clone;
|
734
|
}
|
735
|
|
736
|
function shivMethods(ownerDocument, data) {
|
737
|
if (!data.cache) {
|
738
|
data.cache = {};
|
739
|
data.createElem = ownerDocument.createElement;
|
740
|
data.createFrag = ownerDocument.createDocumentFragment;
|
741
|
data.frag = data.createFrag();
|
742
|
}
|
743
|
|
744
|
|
745
|
ownerDocument.createElement = function(nodeName) {
|
746
|
if (!html5.shivMethods) {
|
747
|
return data.createElem(nodeName);
|
748
|
}
|
749
|
return createElement(nodeName, ownerDocument, data);
|
750
|
};
|
751
|
|
752
|
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
753
|
'var n=f.cloneNode(),c=n.createElement;' +
|
754
|
'h.shivMethods&&(' +
|
755
|
getElements().join().replace(/[\w\-]+/g, function(nodeName) {
|
756
|
data.createElem(nodeName);
|
757
|
data.frag.createElement(nodeName);
|
758
|
return 'c("' + nodeName + '")';
|
759
|
}) +
|
760
|
');return n}'
|
761
|
)(html5, data.frag);
|
762
|
}
|
763
|
|
764
|
function shivDocument(ownerDocument) {
|
765
|
if (!ownerDocument) {
|
766
|
ownerDocument = document;
|
767
|
}
|
768
|
var data = getExpandoData(ownerDocument);
|
769
|
|
770
|
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
771
|
data.hasCSS = !!addStyleSheet(ownerDocument,
|
772
|
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
773
|
'mark{background:#FF0;color:#000}' +
|
774
|
'template{display:none}'
|
775
|
);
|
776
|
}
|
777
|
if (!supportsUnknownElements) {
|
778
|
shivMethods(ownerDocument, data);
|
779
|
}
|
780
|
return ownerDocument;
|
781
|
}
|
782
|
|
783
|
var html5 = {
|
784
|
|
785
|
'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',
|
786
|
|
787
|
'version': version,
|
788
|
|
789
|
'shivCSS': (options.shivCSS !== false),
|
790
|
|
791
|
'supportsUnknownElements': supportsUnknownElements,
|
792
|
|
793
|
'shivMethods': (options.shivMethods !== false),
|
794
|
|
795
|
'type': 'default',
|
796
|
|
797
|
'shivDocument': shivDocument,
|
798
|
|
799
|
createElement: createElement,
|
800
|
|
801
|
createDocumentFragment: createDocumentFragment
|
802
|
};
|
803
|
|
804
|
window.html5 = html5;
|
805
|
|
806
|
shivDocument(document);
|
807
|
|
808
|
}(this, document));
|
809
|
|
810
|
Modernizr._version = version;
|
811
|
|
812
|
Modernizr._prefixes = prefixes;
|
813
|
Modernizr._domPrefixes = domPrefixes;
|
814
|
Modernizr._cssomPrefixes = cssomPrefixes;
|
815
|
|
816
|
Modernizr.mq = testMediaQuery;
|
817
|
|
818
|
Modernizr.hasEvent = isEventSupported;
|
819
|
|
820
|
Modernizr.testProp = function(prop){
|
821
|
return testProps([prop]);
|
822
|
};
|
823
|
|
824
|
Modernizr.testAllProps = testPropsAll;
|
825
|
|
826
|
|
827
|
Modernizr.testStyles = injectElementWithStyles;
|
828
|
Modernizr.prefixed = function(prop, obj, elem){
|
829
|
if(!obj) {
|
830
|
return testPropsAll(prop, 'pfx');
|
831
|
} else {
|
832
|
return testPropsAll(prop, obj, elem);
|
833
|
}
|
834
|
};
|
835
|
|
836
|
|
837
|
docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
|
838
|
|
839
|
(enableClasses ? ' js ' + classes.join(' ') : '');
|
840
|
|
841
|
return Modernizr;
|
842
|
|
843
|
})(this, this.document);
|
844
|
/*yepnope1.5.4|WTFPL*/
|
845
|
(function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}})(this,document);
|
846
|
Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0));};
|
847
|
;
|