fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
smartxml: allow for removing node data for a specified key
[fnpeditor.git]
/
src
/
smartxml
/
smartxml.js
diff --git
a/src/smartxml/smartxml.js
b/src/smartxml/smartxml.js
index
749d4f4
..
de70e9b
100644
(file)
--- a/
src/smartxml/smartxml.js
+++ b/
src/smartxml/smartxml.js
@@
-177,8
+177,12
@@
$.extend(ElementNode.prototype, {
nodeType: Node.ELEMENT_NODE,
setData: function(key, value) {
nodeType: Node.ELEMENT_NODE,
setData: function(key, value) {
- if(value !== undefined) {
- this._$.data(key, value);
+ if(arguments.length === 2) {
+ if(_.isUndefined(value)) {
+ this._$.removeData(key);
+ } else {
+ this._$.data(key, value);
+ }
} else {
this._$.removeData(_.keys(this._$.data()));
this._$.data(key);
} else {
this._$.removeData(_.keys(this._$.data()));
this._$.data(key);