wishthis/node_modules/autoprefixer/lib/hacks/placeholder.js

34 lines
711 B
JavaScript
Raw Normal View History

2023-08-17 09:47:40 +00:00
let Selector = require('../selector')
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
class Placeholder extends Selector {
2022-01-21 08:28:41 +00:00
/**
* Add old mozilla to possible prefixes
*/
2023-08-17 09:47:40 +00:00
possible() {
return super.possible().concat(['-moz- old', '-ms- old'])
2022-01-21 08:28:41 +00:00
}
2023-08-17 09:47:40 +00:00
2022-01-21 08:28:41 +00:00
/**
* Return different selectors depend on prefix
*/
2023-08-17 09:47:40 +00:00
prefixed(prefix) {
2022-01-21 08:28:41 +00:00
if (prefix === '-webkit-') {
2023-08-17 09:47:40 +00:00
return '::-webkit-input-placeholder'
2022-01-21 08:28:41 +00:00
}
if (prefix === '-ms-') {
2023-08-17 09:47:40 +00:00
return '::-ms-input-placeholder'
2022-01-21 08:28:41 +00:00
}
if (prefix === '-ms- old') {
2023-08-17 09:47:40 +00:00
return ':-ms-input-placeholder'
2022-01-21 08:28:41 +00:00
}
if (prefix === '-moz- old') {
2023-08-17 09:47:40 +00:00
return ':-moz-placeholder'
2022-01-21 08:28:41 +00:00
}
2023-08-17 09:47:40 +00:00
return `::${prefix}placeholder`
}
}
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
Placeholder.names = ['::placeholder']
2022-01-21 08:28:41 +00:00
2023-08-17 09:47:40 +00:00
module.exports = Placeholder