bootstrapped 0.0.6 → 0.9.0

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