Skip to content

Commit

Permalink
Fix a cyclic updates microdata -> nodeValue -> textNode -> nodeValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Inviz committed Apr 11, 2012
1 parent 3c944a3 commit 8d9fb2f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/DOM/Element.js
Expand Up @@ -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. Different types of elements have different strategies to define value.
Expand Down
12 changes: 6 additions & 6 deletions Source/Object/Journal.js
Expand Up @@ -81,14 +81,14 @@ LSD.Journal.prototype.set = function(key, value, memo, prepend, old) {
var j = group.length; var j = group.length;
if (prepend) { if (prepend) {
for (var i = 0; i < j; i++) if (group[i] === old) { for (var i = 0; i < j; i++) if (group[i] === old) {
group.splice(i, 1); group.splice(i, 1);
break; break;
} }
} else { } else {
for (; --j > -1;) if (group[j] === old) { for (; --j > -1;) if (group[j] === old) {
group.splice(j, 1); group.splice(j, 1);
break; break;
} }
} }
} }
if (vdef) if (vdef)
Expand Down
4 changes: 2 additions & 2 deletions Source/Properties/Attributes.js
Expand Up @@ -64,6 +64,7 @@ LSD.Properties.Microdata.prototype.onChange = function(key, value, memo, old) {
if (odef && old !== storage[key]) odef = old = undefined; if (odef && old !== storage[key]) odef = old = undefined;
if (typeof storage[key] == 'undefined' ? !vdef || value === element.nodeValue : !odef) return; if (typeof storage[key] == 'undefined' ? !vdef || value === element.nodeValue : !odef) return;
if (vdef) storage[key] = value; if (vdef) storage[key] = value;
else delete storage[key];
element.mix('nodeValue', value, 'microdata', old); element.mix('nodeValue', value, 'microdata', old);
} }
} }
Expand All @@ -80,8 +81,7 @@ LSD.Properties.Microdata.prototype._script = function(key, value, memo) {
value.watch('nodeValue', [this, key]); value.watch('nodeValue', [this, key]);
} }
LSD.Properties.Microdata.prototype._unscript = function(key, value, memo) { LSD.Properties.Microdata.prototype._unscript = function(key, value, memo) {
if (this._elements[key] === value) delete this._elements[key]; var group = this._elements[key];
else this._elements[key].splice(this._elements[key].indexOf(value), 1);
value.unwatch('nodeValue', [this, key]); value.unwatch('nodeValue', [this, key]);
} }
LSD.Properties.Variables = LSD.Struct('Journal'); LSD.Properties.Variables = LSD.Struct('Journal');
Expand Down

0 comments on commit 8d9fb2f

Please sign in to comment.