| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657 |
1×
1×
1×
1×
1×
1×
83×
83×
83×
83×
83×
83×
14×
2×
1×
166×
166×
1×
84×
84×
1×
102×
1×
122×
1×
159×
1×
616×
616×
616×
1×
48×
48×
1×
88×
1×
591×
591×
1×
32×
15×
15×
45×
45×
3×
3×
15×
15×
15×
15×
3×
3×
3×
3×
1×
1×
1×
29×
12×
12×
12×
84×
84×
7×
1×
1×
1×
1×
1×
1×
38×
21×
84×
84×
378×
20×
20×
84×
210×
21×
1×
1×
1×
8×
8×
20×
2×
2×
2×
2×
14×
14×
21×
2×
1×
33×
1×
38×
22×
22×
33×
4×
12×
29×
26×
33×
33×
18×
16×
16×
33×
1×
41×
1×
264×
41×
24×
24×
264×
264×
8×
8×
8×
1×
143×
1×
24×
24×
24×
24×
24×
24×
24×
1×
1×
1×
8×
8×
37×
12×
12×
13×
8×
6×
6×
8×
8×
1×
118×
1×
118×
1×
59×
59×
44×
44×
59×
59×
59×
6×
59×
2×
59×
59×
59×
59×
4×
59×
59×
59×
1×
12×
59×
59×
17×
59×
56×
56×
53×
44×
44×
11×
14×
44×
6×
3×
6×
44×
59×
59×
3×
3×
6×
59×
2×
5×
59×
1×
9×
59×
3×
1×
1×
25×
25×
25×
1×
1×
36×
36×
36×
35×
34×
34×
35×
35×
37×
14×
56×
54×
1×
53×
53×
6×
3×
5×
3×
3×
3×
47×
5×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
| // This file is generated by `../script/build.js`, from `./_exposed.es6.js`
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
// Derived from Lea Verou's PrefixFree
var allStyles;
var styleAttr;
var styleElement;
var supportedDecl;
function init() {
allStyles = getComputedStyle(document.documentElement, null);
styleAttr = document.createElement('div').style;
styleElement = document.documentElement.appendChild(document.createElement('style'));
supportedDecl = _supportedDecl;
exports.supportedProperty = _supportedProperty;
if ('zIndex' in styleAttr && !('z-index' in styleAttr)) {
// Some browsers like it dash-cased, some camelCased, most like both.
supportedDecl = function(property, value) {return _supportedDecl(camelCase(property), value)};
exports.supportedProperty = function(property) {return _supportedProperty(camelCase(property))};
}
}
function finalize() {
if (typeof document !== 'undefined') document.documentElement.removeChild(styleElement);
// `styleAttr` is used at run time via `supportedProperty()`
// `allStyles` and `styleElement` can be displosed of after initialization.
allStyles = styleElement = null;
}
function cleanupDetectorUtils() {
finalize();
styleAttr = null;
}
function hasCleanState() {
return allStyles == null && styleAttr == null && styleElement == null
}
// Helpers, in alphabetic order
function camelCase(str) {
return str.replace(/-([a-z])/g, function($0, $1) { return $1.toUpperCase() }).replace('-','')
}
function deCamelCase(str) {
return str.replace(/[A-Z]/g, function($0) { return '-' + $0.toLowerCase() })
}
function _supportedDecl(property, value) {
styleAttr[property] = '';
styleAttr[property] = value;
return !!styleAttr[property]
}
function supportedMedia(property, value) {
styleElement.textContent = '@media (' + property + ':' + value +'){}';
// The !!~indexOf trick. False for -1, true otherwise.
return !!~styleElement.sheet.cssRules[0].cssText.indexOf(value)
}
function _supportedProperty(property) {
return property in styleAttr
}
function supportedRule(selector) {
styleElement.textContent = selector + '{}';
return !!styleElement.sheet.cssRules.length
}
// Derived from Lea Verou's PrefixFree
// TODO: http://caniuse.com/#feat=css-media-resolution
function detectAtrules(fixers) {
if (fixers.prefix === '') return
var atrules = {
'keyframes': 'name',
'viewport': null,
'document': 'regexp(".")'
};
// build a map of {'@ruleX': '@-prefix-ruleX'}
for(var atrule in atrules) {
var test = atrule + ' ' + (atrules[atrule] || '');
if (!supportedRule('@' + test) && supportedRule('@' + fixers.prefix + test)) {
fixers.hasAtrules = true;
fixers.atrules['@' + atrule] = '@' + fixers.prefix + atrule;
}
}
// Standard
fixers.hasDppx = supportedMedia('resolution', '1dppx');
// Webkit
fixers.hasPixelRatio = supportedMedia(fixers.prefix + 'device-pixel-ratio', '1');
// Opera
fixers.hasPixelRatioFraction = supportedMedia(fixers.prefix + 'device-pixel-ratio', '1/1');
if (fixers.hasPixelRatio || fixers.hasPixelRatioFraction) {
fixers.properties['resolution'] = fixers.prefix + 'device-pixel-ratio';
fixers.properties['min-resolution'] = fixers.prefix + 'min-device-pixel-ratio';
fixers.properties['max-resolution'] = fixers.prefix + 'max-device-pixel-ratio';
if (supportedMedia('min-' + fixers.prefix + 'device-pixel-ratio', '1')) {
// Mozilla/Firefox tunred a vendor prefix into a vendor infix
fixers.properties['min-resolution'] = 'min-' + fixers.prefix + 'device-pixel-ratio';
fixers.properties['max-resolution'] = 'max-' + fixers.prefix + 'device-pixel-ratio';
}
}
}
// Derived from Lea Verou's PrefixFree
function detectFunctions(fixers) {
// Values that might need prefixing
if (fixers.prefix === '') return
var functions = {
'linear-gradient': {
property: 'background-image',
params: 'red, teal'
},
'calc': {
property: 'width',
params: '1px + 5%'
},
'element': {
property: 'background-image',
params: '#foo'
},
'cross-fade': {
property: 'backgroundImage',
params: 'url(a.png), url(b.png), 50%'
}
};
functions['repeating-linear-gradient'] =
functions['repeating-radial-gradient'] =
functions['radial-gradient'] =
functions['linear-gradient'];
// build an array of prefixable functions
for (var func in functions) {
var test = functions[func],
property = test.property,
value = func + '(' + test.params + ')';
if (!supportedDecl(property, value) && supportedDecl(property, fixers.prefix + value)) {
// It's only supported with a prefix
fixers.functions.push(func);
}
}
}
// Derived from Lea Verou's PrefixFree and Robin Frischmann's Inline Style Prefixer
// TODO: http://caniuse.com/#feat=css-writing-mode
// db of prop/value pairs whose values may need treatment.
var keywords = [
// `initial` applies to all properties and is thus handled separately.
{
props: ['cursor'],
values: [ 'grab', 'grabbing', 'zoom-in', 'zoom-out']
},
{
props: ['display'],
values:['box', 'inline-box', 'flexbox', 'inline-flexbox', 'flex', 'inline-flex', 'grid', 'inline-grid']
},
{
props: ['position'],
values: [ 'sticky' ]
},
{
props: ['width', 'column-width', 'height', 'max-height', 'max-width', 'min-height', 'min-width'],
values: ['contain-floats', 'fill-available', 'fit-content', 'max-content', 'min-content']
}
];
// The flexbox zoo
//
// ## Specs:
// - box (2009/old): https://www.w3.org/TR/2009/WD-css3-flexbox-20090723/
// - flexbox (2012/ie10): https://www.w3.org/TR/2012/WD-css3-flexbox-20120322/
// - flex (final): https://www.w3.org/TR/css-flexbox-1/
var flex2009Props = {
// ?align-content =>
// ?align-self =>
'align-items': 'box-align',
'flex': 'box-flex', // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025,
// ?flex-basis =>
// !!flex-direction => box-direction + box-orient, covered in `plugin.js`
'box-direction' : 'box-direction', // we prepopulate the cache for the above case.
'box-orient': 'box-orient',
// !!flex-flow => flex-direction and/or flex-wrap, covered in `plugin.js`
// ?flex-grow =>
// ?flex-shrink =>
'flex-wrap': 'box-lines',
'justify-content': 'box-pack',
'order': 'box-ordinal-group' // https://css-tricks.com/snippets/css/a-guide-to-flexbox/#comment-371025
};
var flex2009Values = {
// flex => box || only for display? handled in the code
'flex-end': 'end',
'flex-start': 'start',
// inline-flex => inline-box || see flex
'nowrap': 'single',
'space-around': 'justify',
'space-between': 'justify',
'wrap': 'multiple',
'wrap-reverse': 'multiple'
};
var flex2012Props = {
'align-content': '-ms-flex-line-pack',
'align-items': '-ms-flex-align',
'align-self': '-ms-flex-item-align',
// flex => -ms-flex
'flex-basis': '-ms-preferred-size',
// flex-direction => -ms-flex-direction
// flex-flow => -ms-flex-flow
'flex-grow': '-ms-flex-positive',
'flex-shrink': '-ms-flex-negative',
// flex-wrap => -ms-flex-wrap
'justify-content': '-ms-flex-pack',
'order': '-ms-flex-order'
};
var flex2012Values = {
// flex => flexbox || only for display? handled in the code
'flex-end': 'end',
'flex-start': 'start',
// inline-flex => inline-flexbox || see 'flex'
// nowrap => nowrap
'space-around': 'distribute',
'space-between': 'justify'
// wrap => wrap
// wrap-reverse => wrap-reverse
};
function detectKeywords(fixers) {
if (fixers.prefix === '') return
// build a map of {propertyI: {keywordJ: previxedKeywordJ, ...}, ...}
for (var i = 0; i < keywords.length; i++) {
var map = {}, property = keywords[i].props[0];
// eslint-disable-next-line
for (var j = 0, keyword; keyword = keywords[i].values[j]; j++) {
if (
!supportedDecl(property, keyword) &&
supportedDecl(property, fixers.prefix + keyword)
) {
fixers.hasKeywords = true;
map[keyword] = fixers.prefix + keyword;
}
}
// eslint-disable-next-line
for (j = 0; property = keywords[i].props[j]; j++) {
fixers.keywords[property] = map;
}
}
if (fixers.keywords.display && fixers.keywords.display.flexbox && !supportedDecl('display', 'flex')) {
// old IE
fixers.keywords.display.flex = fixers.keywords.display.flexbox;
fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-flexbox'];
for (var k in flex2012Props) {
fixers.properties[k] = flex2012Props[k];
fixers.keywords[k] = flex2012Values;
}
} else if (fixers.keywords.display && fixers.keywords.display.box && !supportedDecl('display', 'flex')) {
// old flexbox spec
fixers.keywords.display.flex = fixers.keywords.display.box;
fixers.keywords.display['inline-flex'] = fixers.keywords.display['inline-box'];
fixers.flexbox2009 = true;
for (k in flex2009Props) {
fixers.properties[k] = fixers.prefix + flex2009Props[k];
fixers.keywords[k] = flex2009Values;
}
}
if (
!supportedDecl('color', 'initial') &&
supportedDecl('color', fixers.prefix + 'initial')
) {
// `initial` does not use the `hasKeywords` branch, no need to set it to true.
fixers.initial = fixers.prefix + 'initial';
}
}
// Derived from Lea Verou's PrefixFree
function detectPrefix(fixers) {
var prefixCounters = {};
// Why are we doing this instead of iterating over properties in a .style object? Because Webkit.
// 1. Older Webkit won't iterate over those.
// 2. Recent Webkit will, but the 'Webkit'-prefixed properties are not enumerable. The 'webkit'
// (lower case 'w') ones are, but they don't `deCamelCase()` into a prefix that we can detect.
function iteration(property) {
if(property.charAt(0) === '-') {
var prefix = property.split('-')[1];
// Count prefix uses
prefixCounters[prefix] = ++prefixCounters[prefix] || 1;
}
}
// Some browsers have numerical indices for the properties, some don't
if(allStyles && allStyles.length > 0) {
for(var i=0; i<allStyles.length; i++) {
iteration(allStyles[i]);
}
} else {
for(var property in allStyles) {
iteration(deCamelCase(property));
}
}
var highest = 0;
for(var prefix in prefixCounters) {
if(highest < prefixCounters[prefix]) {
highest = prefixCounters[prefix];
fixers.prefix = '-' + prefix + '-';
}
}
fixers.Prefix = camelCase(fixers.prefix);
}
// Derived from Lea Verou's PrefixFree
function detectSelectors(fixers) {
var selector, prefixed;
function prefixSelector(selector) {
return selector.replace(/^::?/, function($0) { return $0 + fixers.prefix })
}
if (fixers.prefix === '') return
var selectors = {
':any-link': null,
'::backdrop': null,
':fullscreen': null, //TODO sort out what changed between specs
':full-screen': ':fullscreen',
//sigh
'::placeholder': null,
':placeholder': '::placeholder',
'::input-placeholder': '::placeholder',
':input-placeholder': '::placeholder',
':read-only': null,
':read-write': null,
'::selection': null
};
// builds an array of selectors that need a prefix.
for (selector in selectors) {
prefixed = prefixSelector(selector);
if(!supportedRule(selectors[selector] || selector) && supportedRule(prefixed)) {
fixers.hasSelectors = true;
fixers.selectorList.push(selectors[selector] || selector);
fixers.selectorMap[selectors[selector] || selector] = prefixed;
}
}
}
function blankFixers() {
return {
atrules: {},
hasAtrules: false,
hasDppx: null,
hasKeywords: false,
hasPixelRatio: false,
hasPixelRatioFraction: false,
hasSelectors: false,
hasValues: false,
fixAtMediaParams: null,
fixAtSupportsParams: null,
fixProperty: null,
fixSelector: null,
fixValue: null,
flexbox2009: false,
functions: [],
initial: null,
keywords: {},
placeholder: null,
prefix: '',
Prefix: '',
properties: {},
selectorList: [],
selectorMap: {},
valueProperties: {
'transition': 1,
'transition-property': 1,
'will-change': 1
}
}
}
function browserDetector(fixers) {
// add the required data to the fixers object.
init();
detectPrefix(fixers);
detectSelectors(fixers);
detectAtrules(fixers);
detectKeywords(fixers);
detectFunctions(fixers);
finalize();
}
var emptySet = {};
var valueTokenizer = /[(),]|\/\*[\s\S]*?\*\//g;
/**
* For properties whose values are also properties, this will split a coma-separated
* value list into individual values, ignoring comas in comments and in
* functions(parameter, lists).
*
* @param {string} selector
* @return {string[]}
*/
function splitValue(value) {
var indices = [], res = [], inParen = 0, o;
/*eslint-disable no-cond-assign*/
while (o = valueTokenizer.exec(value)) {
/*eslint-enable no-cond-assign*/
switch (o[0]) {
case '(': inParen++; break
case ')': inParen--; break
case ',': if (inParen) break; indices.push(o.index);
}
}
for (o = indices.length; o--;){
res.unshift(value.slice(indices[o] + 1));
value = value.slice(0, indices[o]);
}
res.unshift(value);
return res
}
function makeDetector (before, targets, after) {
return new RegExp(before + '(?:' + targets.join('|') + ')' + after)
}
function makeLexer (before, targets, after) {
return new RegExp(
"\"(?:\\\\[\\S\\s]|[^\"])*\"|'(?:\\\\[\\S\\s]|[^'])*'|\\/\\*[\\S\\s]*?\\*\\/|" +
before + '((?:' +
targets.join('|') +
'))' + after,
'gi'
)
}
function finalizeFixers(fixers) {
var prefix = fixers.prefix;
// properties
// ----------
fixers.fixProperty = fixers.fixProperty || function(prop) {
var prefixed;
return fixers.properties[prop] = (
exports.supportedProperty(prop) ||
!exports.supportedProperty(prefixed = prefix + prop)
) ? prop : prefixed
};
// selectors
// ----------
var selectorDetector = makeDetector('', fixers.selectorList, '(?:\\b|$|[^-])');
var selectorMatcher = makeLexer('', fixers.selectorList, '(?:\\b|$|[^-])');
var selectorReplacer = function(match, selector) {
return selector != null ? fixers.selectorMap[selector] : match
};
fixers.fixSelector = function(selector) {
return selectorDetector.test(selector) ? selector.replace(selectorMatcher, selectorReplacer) : selector
};
// values
// ------
// When gradients are supported with a prefix, convert angles to legacy
// (from clockwise to trigonometric)
var hasGradients = fixers.functions.indexOf('linear-gradient') > -1;
var gradientDetector = /\blinear-gradient\(/;
var gradientMatcher = /(^|\s|,|\()((?:repeating-)?linear-gradient\()\s*(-?\d*\.?\d*)deg/ig;
var gradientReplacer = function (match, delim, gradient, deg) {
return delim + gradient + (90-deg) + 'deg'
};
// functions
var hasFunctions = !!fixers.functions.length;
var functionsDetector = makeDetector('(?:^|\\s|,|\\()', fixers.functions, '\\s*\\(');
var functionsMatcher = makeLexer('(^|\\s|,|\\()', fixers.functions, '(?=\\s*\\()');
function functionReplacer (match, $1, $2) {
return $1 + prefix + $2
}
// properties as values (for transition, ...)
// No need to look for strings in these properties. We may insert prefixes in comments. Oh the humanity.
var valuePropertiesMatcher = /^\s*([-\w]+)/gi;
var valuePropertiesReplacer = function(match, prop){
return fixers.properties[prop] || fixers.fixProperty(prop)
};
fixers.fixValue = function (value, property) {
var res;
if (fixers.initial != null && value === 'initial') return fixers.initial
if (fixers.hasKeywords && (res = (fixers.keywords[property] || emptySet)[value])) return res
res = value;
if (fixers.valueProperties.hasOwnProperty(property)) {
res = (value.indexOf(',') === -1) ?
value.replace(valuePropertiesMatcher, valuePropertiesReplacer) :
splitValue(value).map(function(v) {
return v.replace(valuePropertiesMatcher, valuePropertiesReplacer)
}).join(',');
}
if (hasFunctions && functionsDetector.test(value)) {
if (hasGradients && gradientDetector.test(value)) {
res = res.replace(gradientMatcher, gradientReplacer);
}
res = res.replace(functionsMatcher, functionReplacer);
}
return res
};
// @media (resolution:...) {
// -------------------------
var resolutionMatcher = /((?:min-|max-)?resolution)\s*:\s*((?:\d*\.)?\d+)dppx/g;
var resolutionReplacer = (
fixers.hasPixelRatio ? function(_, prop, param){return fixers.properties[prop] + ':' + param} :
fixers.hasPixelRatioFraction ? function(_, prop, param){return fixers.properties[prop] + ':' + Math.round(param*10) + '/10'} :
function(_, prop, param){return prop + ':' + Math.round(param * 96) +'dpi'}
);
fixers.fixAtMediaParams = fixers.hasDppx !== false /*it may be null*/ ?
function(p) {return p} :
function (params) {
return (params.indexOf('reso') !== -1) ?
params.replace(resolutionMatcher, resolutionReplacer) :
params
};
// @supports ... {
// ---------------
// regexp built by scripts/regexps.js
var atSupportsParamsMatcher = /\(\s*([-\w]+)\s*:\s*((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|\((?:'(?:\\[\S\s]|[^'])*'|"(?:\\[\S\s]|[^"])*"|\/\*[\S\s]*?\*\/|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*\)|[^\)])*)/g;
function atSupportsParamsReplacer(match, prop, value) {
return '(' + (fixers.properties[prop] || fixers.fixProperty(prop)) + ':' + fixers.fixValue(value, prop)
}
fixers.fixAtSupportsParams = function(params) {
return params.replace(atSupportsParamsMatcher, atSupportsParamsReplacer)
};
}
var commonFixers;
function initBrowser() { // exported for the test suite.
commonFixers = blankFixers();
if (typeof getComputedStyle === 'function') browserDetector(commonFixers);
finalizeFixers(commonFixers);
}
initBrowser();
function prefixPlugin(){
var fixers = commonFixers;
var cache = [];
return {
set: {
setPrefixDb: function(f) {
if (cache.indexOf(f) === -1) {
finalizeFixers(f);
cache.push(f);
}
fixers = f;
return prefixPlugin
}
},
filter: function(next) {
return {
atrule: function(rule, kind, params, hasBlock) {
next.atrule(
fixers.hasAtrules && fixers.atrules[rule] || rule,
kind,
(
rule === '@media' ? fixers.fixAtMediaParams(params) :
rule === '@supports' ? fixers.fixAtSupportsParams(params) :
params
),
hasBlock
);
},
decl: function decl(property, value) {
if (typeof property !== 'string' || property.charAt(0) === '-') return next.decl(property, value)
if (!(typeof value === 'string' || typeof value === 'number')){
return next.decl(fixers.properties[property] || fixers.fixProperty(property), value)
}
value = value + '';
if (fixers.flexbox2009 && (property === 'flex-flow' || property === 'flex-direction')) {
if (property === 'flex-flow') {
value.split(' ').forEach(function(v){
// recurse! The lack of `next.` is intentional.
if (v.indexOf('wrap') > -1) decl('flex-wrap', v);
else if(v !== '') decl('flex-direction', v);
});
} else { // (property === 'flex-direction')
next.decl(fixers.properties['box-orient'], value.indexOf('column') > -1 ? 'block-axis' : 'inline-axis');
next.decl(fixers.properties['box-direction'], value.indexOf('-reverse') > -1 ? 'reverse' : 'normal');
}
} else {
next.decl(
fixers.properties[property] || fixers.fixProperty(property),
fixers.fixValue(value, property)
);
}
},
rule: function(selector) {
next.rule(
fixers.hasSelectors ? fixers.fixSelector(selector) : selector
);
}
}
}
}
}
// Once built as 'exposed.js' by '../scripts/build.js', this script
// exposes every relevant function from the plugin, including private
// ones, for testing.
exports.blankFixers = blankFixers;
exports.finalizeFixers = finalizeFixers;
exports.createPrefixPlugin = prefixPlugin;
exports.initBrowser = initBrowser;
exports.init = init;
exports.finalize = finalize;
exports.cleanupDetectorUtils = cleanupDetectorUtils;
exports.hasCleanState = hasCleanState;
exports.camelCase = camelCase;
exports.deCamelCase = deCamelCase;
exports.detectAtrules = detectAtrules;
exports.detectFunctions = detectFunctions;
exports.detectKeywords = detectKeywords;
exports.keywords = keywords;
exports.flex2009Props = flex2009Props;
exports.flex2009Values = flex2009Values;
exports.flex2012Props = flex2012Props;
exports.flex2012Values = flex2012Values;
exports.detectPrefix = detectPrefix;
exports.detectSelectors = detectSelectors;
|