21 lines
527 B
JavaScript
21 lines
527 B
JavaScript
function removeStyle(node, key) {
|
|
if ('removeProperty' in node.style) {
|
|
node.style.removeProperty(key);
|
|
} else if (typeof node.style.removeAttribute === 'function') {
|
|
node.style.removeAttribute(key);
|
|
}
|
|
}
|
|
/**
|
|
* key(s) typeof [string , array] ?
|
|
*/
|
|
|
|
|
|
export default (function (node, keys) {
|
|
if (typeof keys === 'string') {
|
|
removeStyle(node, keys);
|
|
} else if (Object.prototype.toString.call(keys) === '[object Array]') {
|
|
keys.forEach(function (key) {
|
|
return removeStyle(node, key);
|
|
});
|
|
}
|
|
}); |