Permalink
Browse files

Fix a cyclic updates microdata -> nodeValue -> textNode -> nodeValue

  • Loading branch information...
Inviz committed Apr 11, 2012
1 parent 3c944a3 commit 8d9fb2f28ced11674ccb4f7ba709d17f7962ef14
Showing with 9 additions and 9 deletions.
  1. +1 −1 Source/DOM/Element.js
  2. +6 −6 Source/Object/Journal.js
  3. +2 −2 Source/Properties/Attributes.js
View
@@ -600,7 +600,7 @@ LSD.Element.prototype.__properties = {
}
}
}
- this.set('nodeValue', value, 'textContent', true, old);
+ if (memo !== 'nodeValue') this.set('nodeValue', value, 'textContent', true, old);
},
/*
Different types of elements have different strategies to define value.
View
@@ -81,14 +81,14 @@ LSD.Journal.prototype.set = function(key, value, memo, prepend, old) {
var j = group.length;
if (prepend) {
for (var i = 0; i < j; i++) if (group[i] === old) {
- group.splice(i, 1);
- break;
- }
+ group.splice(i, 1);
+ break;
+ }
} else {
for (; --j > -1;) if (group[j] === old) {
- group.splice(j, 1);
- break;
- }
+ group.splice(j, 1);
+ break;
+ }
}
}
if (vdef)
@@ -64,6 +64,7 @@ LSD.Properties.Microdata.prototype.onChange = function(key, value, memo, old) {
if (odef && old !== storage[key]) odef = old = undefined;
if (typeof storage[key] == 'undefined' ? !vdef || value === element.nodeValue : !odef) return;
if (vdef) storage[key] = value;
+ else delete storage[key];
element.mix('nodeValue', value, 'microdata', old);
}
}
@@ -80,8 +81,7 @@ LSD.Properties.Microdata.prototype._script = function(key, value, memo) {
value.watch('nodeValue', [this, key]);
}
LSD.Properties.Microdata.prototype._unscript = function(key, value, memo) {
- if (this._elements[key] === value) delete this._elements[key];
- else this._elements[key].splice(this._elements[key].indexOf(value), 1);
+ var group = this._elements[key];
value.unwatch('nodeValue', [this, key]);
}
LSD.Properties.Variables = LSD.Struct('Journal');

0 comments on commit 8d9fb2f

Please sign in to comment.