Slight changes to make the code more readable

master
Magne Bratseth 2016-02-25 09:03:20 +01:00
parent d19cc062c5
commit 0cf2fc57a1
1 changed files with 9 additions and 3 deletions

View File

@ -620,7 +620,6 @@ svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCh
// Parameters: // Parameters:
// element - DOM element to clean up // element - DOM element to clean up
svgedit.utilities.cleanupElement = function(element) { svgedit.utilities.cleanupElement = function(element) {
var nodeName = element.nodeName ? element.nodeName : '';
var defaults = { var defaults = {
'fill-opacity':1, 'fill-opacity':1,
'stop-opacity':1, 'stop-opacity':1,
@ -631,10 +630,17 @@ svgedit.utilities.cleanupElement = function(element) {
'stroke-linecap':'butt', 'stroke-linecap':'butt',
'stroke-opacity':1, 'stroke-opacity':1,
'stroke-width':1, 'stroke-width':1,
'rx': (nodeName == 'ellipse' ? null : 0), // rx=0 and ry=0 is valid value which are different than null/empty 'rx': 0,
'ry': (nodeName == 'ellipse' ? null : 0) 'ry': 0
}; };
var nodeName = element.nodeName ? element.nodeName : '';
if (nodeName == 'ellipse') {
// Ellipse elements requires rx and ry attributes
delete defaults.rx;
delete defaults.ry;
}
var attr; var attr;
for (attr in defaults) { for (attr in defaults) {
var val = defaults[attr]; var val = defaults[attr];