diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-05 19:02:35 +0100 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2018-11-05 19:02:35 +0100 |
commit | 2f8d32a1f4fbe51c4e6ac381d5d663d8f11fc1f9 (patch) | |
tree | 4abb508477aa4b6b811f89731011661783a2225c /src/css.js | |
parent | 4049e2e6361d5ed9120f1edd02ef96ecc138fa6d (diff) | |
download | svg.js-2f8d32a1f4fbe51c4e6ac381d5d663d8f11fc1f9.tar.gz svg.js-2f8d32a1f4fbe51c4e6ac381d5d663d8f11fc1f9.zip |
Linted all files, upgraded all dependencies
Diffstat (limited to 'src/css.js')
-rw-r--r-- | src/css.js | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -1,21 +1,20 @@ -import {camelCase} from './helpers.js' -import {isBlank} from './regex.js' -import {registerMethods} from './methods.js' +import { camelCase } from './helpers.js' +import { isBlank } from './regex.js' +import { registerMethods } from './methods.js' // FIXME: We dont need exports - // Dynamic style generator +// Dynamic style generator export function css (style, val) { let ret = {} - let i if (arguments.length === 0) { // get full style as object this.node.style.cssText.split(/\s*;\s*/) .filter(function (el) { return !!el.length }) .forEach(function (el) { - let t = el.split(/\s*:\s*/) - ret[t[0]] = t[1] - }) + let t = el.split(/\s*:\s*/) + ret[t[0]] = t[1] + }) return ret } @@ -36,7 +35,7 @@ export function css (style, val) { // set styles in object if (typeof style === 'object') { - for (name in style) { + for (let name in style) { // set empty string if null/undefined/'' was given this.node.style[camelCase(name)] = (style[name] == null || isBlank.test(style[name])) ? '' : style[name] @@ -53,17 +52,17 @@ export function css (style, val) { return this } - // Show element +// Show element export function show () { return this.css('display', '') } - // Hide element +// Hide element export function hide () { return this.css('display', 'none') } - // Is element visible? +// Is element visible? export function visible () { return this.css('display') !== 'none' } |