wishthis/node_modules/autoprefixer/lib/hacks/image-set.js

19 lines
395 B
JavaScript
Raw Normal View History

2023-08-17 09:47:40 +00:00
let Value = require('../value')
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
class ImageSet extends Value {
2022-01-21 08:28:41 +00:00
/**
* Use non-standard name for WebKit and Firefox
*/
2023-08-17 09:47:40 +00:00
replace(string, prefix) {
let fixed = super.replace(string, prefix)
2022-01-21 08:28:41 +00:00
if (prefix === '-webkit-') {
2023-08-17 09:47:40 +00:00
fixed = fixed.replace(/("[^"]+"|'[^']+')(\s+\d+\w)/gi, 'url($1)$2')
2022-01-21 08:28:41 +00:00
}
2023-08-17 09:47:40 +00:00
return fixed
}
}
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
ImageSet.names = ['image-set']
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
module.exports = ImageSet