Files

14 lines
472 B
JavaScript

import { modifier } from 'ember-modifier';
// Sets a single CSS property through the CSSOM (not a template-bound style
// attribute) so the browser validates the value and Ember's XSS-prone style
// binding deprecation is avoided.
export default modifier((element, [property, value]) => {
if (value === undefined || value === null || value === '') {
element.style.removeProperty(property);
return;
}
element.style.setProperty(property, String(value));
});