From f47eee9a0cadc2f342da542cff4b95ba737a8558 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 13 Aug 2014 10:06:56 +0200 Subject: [PATCH] smartxml: removing node attributes by setting undefined as their value Before this change calling Node.setAttr(undefined) was a noop. --- src/smartxml/core.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/smartxml/core.js b/src/smartxml/core.js index b60bc2e..7326507 100644 --- a/src/smartxml/core.js +++ b/src/smartxml/core.js @@ -169,7 +169,11 @@ var elementNodeTransformations = { setAttr: function(name, value, silent) { var oldVal = this.getAttr(name); - this._$.attr(name, value); + if(_.isUndefined(value)) { + this._$.removeAttr(name); + } else { + this._$.attr(name, value); + } if(!silent) { this.triggerChangeEvent('nodeAttrChange', {attr: name, oldVal: oldVal, newVal: value}); } -- 2.20.1