Skip to content

Commit

Permalink
performance improvement for text binding
Browse files Browse the repository at this point in the history
  • Loading branch information
eavichay committed May 3, 2017
1 parent 6924434 commit a52fefe
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Slim.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ var Slim = function (_HTMLElement) {
} else if (descriptor.type === 'T') {
executor = function executor() {
var source = descriptor.target._boundParent;
descriptor.target.innerText = descriptor.target.innerText.replace('[[' + prop + ']]', Slim.__lookup(source, prop).obj);
descriptor.target._innerText = descriptor.target._innerText.replace('[[' + prop + ']]', Slim.__lookup(source, prop).obj);
};
} else if (descriptor.type === 'R') {
executor = function executor() {
Expand Down Expand Up @@ -695,7 +695,7 @@ var Slim = function (_HTMLElement) {
this._boundChildren.forEach(function (child) {
// this._boundChildren.forEach( child => {
if (child.hasAttribute('bind') && child.sourceText !== undefined) {
child.innerText = child.sourceText;
child._innerText = child.sourceText;
}
});

Expand All @@ -714,6 +714,11 @@ var Slim = function (_HTMLElement) {
fn();
}
});
_this3._bindings[property].executors.forEach(function (fn) {
if (fn.descriptor.type === 'T') {
fn.descriptor.target.innerText = fn.descriptor.target._innerText;
}
});
});
}

Expand Down
Loading

0 comments on commit a52fefe

Please sign in to comment.