Skip to content

Commit

Permalink
Removes value guard from addAttrs, allows writing valueless attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Jones authored and Greg Jones committed May 7, 2016
1 parent e0ca3f0 commit a100c53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 12 additions & 5 deletions lib/svgo/js2svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,18 @@ JS2SVG.prototype.createAttrs = function(elem) {

elem.eachAttr(function(attr) {

attrs += ' ' +
attr.name +
this.config.attrStart +
String(attr.value).replace(this.config.regValEntities, this.config.encodeEntity) +
this.config.attrEnd;
if (attr.value) {
attrs += ' ' +
attr.name +
this.config.attrStart +
String(attr.value).replace(this.config.regValEntities, this.config.encodeEntity) +
this.config.attrEnd;
}
else {
attrs += ' ' +
attr.name;
}


}, this);

Expand Down
1 change: 0 additions & 1 deletion lib/svgo/jsAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ JSAPI.prototype.renameElem = function(name) {
attr = attr || {};

if (attr.name === undefined ||
attr.value === undefined ||
attr.prefix === undefined ||
attr.local === undefined
) return false;
Expand Down

0 comments on commit a100c53

Please sign in to comment.