aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/css.js b/src/css.js
index 3ecb2b9..c549bd5 100644
--- a/src/css.js
+++ b/src/css.js
@@ -1,10 +1,13 @@
+/* global camelCase */
+
SVG.extend(SVG.Element, {
// Dynamic style generator
- css: function(s, v) {
- var t, i, ret = {}
- if (arguments.length == 0) {
+ css: function (s, v) {
+ var ret = {}
+ var t, 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) {
+ this.node.style.cssText.split(/\s*;\s*/).filter(function (el) { return !!el.length }).forEach(function (el) {
t = el.split(/\s*:\s*/)
ret[t[0]] = t[1]
})
@@ -13,21 +16,21 @@ SVG.extend(SVG.Element, {
if (arguments.length < 2) {
// get style properties in the array
- if(Array.isArray(s)) {
- for(i = s.length; i--;) {
+ if (Array.isArray(s)) {
+ for (i = s.length; i--;) {
ret[camelCase(s[i])] = this.node.style[camelCase(s[i])]
}
return ret
}
// get style for property
- if(typeof s == 'string') {
+ if (typeof s === 'string') {
return this.node.style[camelCase(s)]
}
// set styles in object
- if(typeof s == 'object') {
- for(i in s) {
+ if (typeof s === 'object') {
+ for (i in s) {
// set empty string if null/undefined/'' was given
this.node.style[camelCase(i)] = (s[i] == null || SVG.regex.isBlank.test(s[i])) ? '' : s[i]
}
@@ -35,7 +38,7 @@ SVG.extend(SVG.Element, {
}
// set style for property
- if (arguments.length == 2) {
+ if (arguments.length === 2) {
this.node.style[camelCase(s)] = (v == null || SVG.regex.isBlank.test(v)) ? '' : v
}