From 768619c239c64fa3f4e3cd0e2c34c1ca517dd80b Mon Sep 17 00:00:00 2001 From: eavichay Date: Tue, 10 Jan 2017 11:05:28 +0200 Subject: [PATCH] fixing text binding lookup --- Slim.js | 16 +++++----------- framework/components/basic-elements.js | 4 ---- framework/tests/slim-ui-test.js | 4 ---- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Slim.js b/Slim.js index 81113f9..b5c4b10 100644 --- a/Slim.js +++ b/Slim.js @@ -242,7 +242,6 @@ class Slim extends HTMLElement { } initialize(forceNewVirtualDOM = false) { - this._executeByBindAttribute = true this._bindings = this._bindings || {} this._boundChildren = this._boundChildren || [] this.alternateTemplate = this.alternateTemplate || null @@ -279,15 +278,9 @@ class Slim extends HTMLElement { _executeBindings() { - let children - if (this._executeByBindAttribute == false) { - children = this._boundChildren - } else { - children = this.findAll('*[bind]') - } - children.forEach( child => { - // this._boundChildren.forEach( child => { - if (child.sourceText !== undefined) { + this._boundChildren.forEach( child => { + // this._boundChildren.forEach( child => { + if (child.hasAttribute('bind') && child.sourceText !== undefined) { child.innerText = child.sourceText } }) @@ -382,7 +375,8 @@ Slim.__prototypeDict = {} Slim.__plugins = { 'create': [], 'beforeRender': [], - 'afterRender': [] + 'afterRender': [], + 'beforeDestroy': [] } try { diff --git a/framework/components/basic-elements.js b/framework/components/basic-elements.js index d7a7d70..0610108 100644 --- a/framework/components/basic-elements.js +++ b/framework/components/basic-elements.js @@ -62,10 +62,6 @@ Slim.tag('s-editable-input', class extends Slim { return `[[text]]` } - onBeforeCreated() { - this._executeByBindAttribute = true - } - onCreated() { this._boundProperty = this.getAttribute('text') if (this._boundProperty && this._boundProperty.indexOf('@' === 0)) { diff --git a/framework/tests/slim-ui-test.js b/framework/tests/slim-ui-test.js index ae319e8..dad6ae3 100644 --- a/framework/tests/slim-ui-test.js +++ b/framework/tests/slim-ui-test.js @@ -34,10 +34,6 @@ Slim.tag('slim-ui-test', class extends Slim { Slim.tag('editable-ui-test', class extends Slim { - onBeforeCreated() { - this._executeByBindAttribute = false - } - get template() { return '
Hello, [[myText]]
' }