35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
|
var alternativeProps = {
|
||
|
marginBlockStart: ['WebkitMarginBefore'],
|
||
|
marginBlockEnd: ['WebkitMarginAfter'],
|
||
|
marginInlineStart: ['WebkitMarginStart', 'MozMarginStart'],
|
||
|
marginInlineEnd: ['WebkitMarginEnd', 'MozMarginEnd'],
|
||
|
paddingBlockStart: ['WebkitPaddingBefore'],
|
||
|
paddingBlockEnd: ['WebkitPaddingAfter'],
|
||
|
paddingInlineStart: ['WebkitPaddingStart', 'MozPaddingStart'],
|
||
|
paddingInlineEnd: ['WebkitPaddingEnd', 'MozPaddingEnd'],
|
||
|
borderBlockStart: ['WebkitBorderBefore'],
|
||
|
borderBlockStartColor: ['WebkitBorderBeforeColor'],
|
||
|
borderBlockStartStyle: ['WebkitBorderBeforeStyle'],
|
||
|
borderBlockStartWidth: ['WebkitBorderBeforeWidth'],
|
||
|
borderBlockEnd: ['WebkitBorderAfter'],
|
||
|
borderBlockEndColor: ['WebkitBorderAfterColor'],
|
||
|
borderBlockEndStyle: ['WebkitBorderAfterStyle'],
|
||
|
borderBlockEndWidth: ['WebkitBorderAfterWidth'],
|
||
|
borderInlineStart: ['WebkitBorderStart', 'MozBorderStart'],
|
||
|
borderInlineStartColor: ['WebkitBorderStartColor', 'MozBorderStartColor'],
|
||
|
borderInlineStartStyle: ['WebkitBorderStartStyle', 'MozBorderStartStyle'],
|
||
|
borderInlineStartWidth: ['WebkitBorderStartWidth', 'MozBorderStartWidth'],
|
||
|
borderInlineEnd: ['WebkitBorderEnd', 'MozBorderEnd'],
|
||
|
borderInlineEndColor: ['WebkitBorderEndColor', 'MozBorderEndColor'],
|
||
|
borderInlineEndStyle: ['WebkitBorderEndStyle', 'MozBorderEndStyle'],
|
||
|
borderInlineEndWidth: ['WebkitBorderEndWidth', 'MozBorderEndWidth']
|
||
|
};
|
||
|
|
||
|
export default function logical(property, value, style) {
|
||
|
if (Object.prototype.hasOwnProperty.call(alternativeProps, property)) {
|
||
|
var alternativePropList = alternativeProps[property];
|
||
|
for (var i = 0, len = alternativePropList.length; i < len; ++i) {
|
||
|
style[alternativePropList[i]] = value;
|
||
|
}
|
||
|
}
|
||
|
}
|