Mirror: CSS prefixing helpers in less than 1KB 馃寛
1import /* codegen */ '../scripts/generate-prefix-map';
2
3const ms = 0b001;
4const moz = 0b010;
5const webkit = 0b100;
6const cache = {};
7
8export const prefixProperty = prop => {
9 if (cache[prop]) return cache[prop];
10 return (cache[prop] = (msPrefixRe.test(prop) ? ms : 0)
11 | (mozPrefixRe.test(prop) ? moz : 0)
12 | (webkitPrefixRe.test(prop) ? webkit : 0));
13};
14
15export const prefixValue = (prop, value) => {
16 if (
17 (prop === 'position' && value === 'sticky') ||
18 (prop === 'background-clip' && value === 'text')
19 ) {
20 return `-webkit-${value}, ${value}`;
21 }
22
23 return value;
24};