Mirror: CSS prefixing helpers in less than 1KB 馃寛
at v1.1.2 580 B view raw
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] = (ms * msPrefixRe.test(prop)) 11 | (moz * mozPrefixRe.test(prop)) 12 | (webkit * webkitPrefixRe.test(prop))); 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};