tui-code-snippet
Version:
TOAST UI Utility: CodeSnippet
33 lines (25 loc) • 679 B
JavaScript
/**
* @fileoverview Setting element style
* @author NHN FE Development Lab <dl_javascript@nhn.com>
*/
;
var isString = require('../type/isString');
var forEach = require('../collection/forEach');
/**
* Setting element style
* @param {(HTMLElement|SVGElement)} element - element to setting style
* @param {(string|object)} key - style prop name or {prop: value} pair object
* @param {string} [value] - style value
* @memberof module:domUtil
*/
function css(element, key, value) {
var style = element.style;
if (isString(key)) {
style[key] = value;
return;
}
forEach(key, function(v, k) {
style[k] = v;
});
}
module.exports = css;