diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:54:57 +0100 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:57:48 +0100 |
| commit | b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c (patch) | |
| tree | 49d360fd6cbc6a2754efe93524ac47ff0fbe0f7d /node_modules/autoprefixer/lib/hacks/border-radius.js | |
Docs
Diffstat (limited to 'node_modules/autoprefixer/lib/hacks/border-radius.js')
| -rw-r--r-- | node_modules/autoprefixer/lib/hacks/border-radius.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/autoprefixer/lib/hacks/border-radius.js b/node_modules/autoprefixer/lib/hacks/border-radius.js new file mode 100644 index 0000000..47ea835 --- /dev/null +++ b/node_modules/autoprefixer/lib/hacks/border-radius.js @@ -0,0 +1,40 @@ +let Declaration = require('../declaration') + +class BorderRadius extends Declaration { + /** + * Return unprefixed version of property + */ + normalize(prop) { + return BorderRadius.toNormal[prop] || prop + } + + /** + * Change syntax, when add Mozilla prefix + */ + prefixed(prop, prefix) { + if (prefix === '-moz-') { + return prefix + (BorderRadius.toMozilla[prop] || prop) + } + return super.prefixed(prop, prefix) + } +} + +BorderRadius.names = ['border-radius'] + +BorderRadius.toMozilla = {} +BorderRadius.toNormal = {} + +for (let ver of ['top', 'bottom']) { + for (let hor of ['left', 'right']) { + let normal = `border-${ver}-${hor}-radius` + let mozilla = `border-radius-${ver}${hor}` + + BorderRadius.names.push(normal) + BorderRadius.names.push(mozilla) + + BorderRadius.toMozilla[normal] = mozilla + BorderRadius.toNormal[mozilla] = normal + } +} + +module.exports = BorderRadius |