aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-16 13:35:35 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-16 13:35:35 +0100
commitdddf54fa855060e117c5e031f59f5d3b30eb251e (patch)
treecdad844e6b7db73bd9d00658de5091f4ecb1e705 /src
parent2e215f1bd2f6a83aee6f27756fc2b11036aaa097 (diff)
downloadsvg.js-dddf54fa855060e117c5e031f59f5d3b30eb251e.tar.gz
svg.js-dddf54fa855060e117c5e031f59f5d3b30eb251e.zip
remove feature to set style with css string
Diffstat (limited to 'src')
-rw-r--r--src/style.js23
-rw-r--r--src/svg.js8
2 files changed, 14 insertions, 17 deletions
diff --git a/src/style.js b/src/style.js
index 14cf863..b5f2702 100644
--- a/src/style.js
+++ b/src/style.js
@@ -2,32 +2,23 @@ SVG.extend(SVG.Element, {
// Dynamic style generator
style: function(s, v) {
if (arguments.length == 0) {
- // get full style
+ // get full style
return this.node.style.cssText || ''
-
+
} else if (arguments.length < 2) {
- // apply every style individually if an object is passed
+ // apply every style individually if an object is passed
if (typeof s == 'object') {
for (v in s) this.style(v, s[v])
-
- } else if (SVG.regex.isCss.test(s)) {
- // parse css string
- s = s.split(';')
- // apply every definition individually
- for (var i = 0; i < s.length; i++) {
- v = s[i].split(':')
- this.style(v[0].replace(/\s+/g, ''), v[1])
- }
} else {
- // act as a getter if the first and only argument is not an object
+ // act as a getter if the first and only argument is not an object
return this.node.style[camelCase(s)]
}
-
+
} else {
this.node.style[camelCase(s)] = v === null || SVG.regex.isBlank.test(v) ? '' : v
}
-
+
return this
}
-}) \ No newline at end of file
+})
diff --git a/src/svg.js b/src/svg.js
index b94b08a..6499d94 100644
--- a/src/svg.js
+++ b/src/svg.js
@@ -135,7 +135,13 @@ SVG.prepare = function() {
// Create parser object
SVG.parser = {
body: body || document.documentElement
- , draw: draw.style('opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden')
+ , draw: draw.style({
+ opacity:0,
+ position:'absolute',
+ left:'-100%',
+ top:'-100%',
+ overflow:'hidden'
+ })
, poly: draw.polyline().node
, path: draw.path().node
, native: SVG.create('svg')