Skip to content

Commit

Permalink
fixing text binding lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
eavichay committed Jan 10, 2017
1 parent d251de5 commit 768619c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
16 changes: 5 additions & 11 deletions Slim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
})
Expand Down Expand Up @@ -382,7 +375,8 @@ Slim.__prototypeDict = {}
Slim.__plugins = {
'create': [],
'beforeRender': [],
'afterRender': []
'afterRender': [],
'beforeDestroy': []
}

try {
Expand Down
4 changes: 0 additions & 4 deletions framework/components/basic-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ Slim.tag('s-editable-input', class extends Slim {
return `<span #label bind>[[text]]</span><input #inp type="text" value=[[text]] />`
}

onBeforeCreated() {
this._executeByBindAttribute = true
}

onCreated() {
this._boundProperty = this.getAttribute('text')
if (this._boundProperty && this._boundProperty.indexOf('@' === 0)) {
Expand Down
4 changes: 0 additions & 4 deletions framework/tests/slim-ui-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<div bind>Hello, [[myText]]</div><s-editable-input text="@myText"></s-editable-input>'
}
Expand Down

0 comments on commit 768619c

Please sign in to comment.