Skip to content

Commit

Permalink
fix(determineDefaultBindingMode): only assign when conditions are mat…
Browse files Browse the repository at this point in the history
  • Loading branch information
jdanyow committed Mar 15, 2016
1 parent b560140 commit c952286
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/syntax-interpreter.js
Expand Up @@ -36,13 +36,11 @@ export class SyntaxInterpreter {
determineDefaultBindingMode(element, attrName, context) {
let tagName = element.tagName.toLowerCase();

if (tagName === 'input') {
return attrName === 'value' || attrName === 'checked' || attrName === 'files' ? bindingMode.twoWay : bindingMode.oneWay;
} else if (tagName === 'textarea' || tagName === 'select') {
return attrName === 'value' ? bindingMode.twoWay : bindingMode.oneWay;
} else if (attrName === 'textcontent' || attrName === 'innerhtml') {
return element.contentEditable === 'true' ? bindingMode.twoWay : bindingMode.oneWay;
} else if (attrName === 'scrolltop' || attrName === 'scrollleft') {
if (tagName === 'input' && (attrName === 'value' || attrName === 'checked' || attrName === 'files')
|| (tagName === 'textarea' || tagName === 'select') && attrName === 'value'
|| (attrName === 'textcontent' || attrName === 'innerhtml') && element.contentEditable === 'true'
|| attrName === 'scrolltop'
|| attrName === 'scrollleft') {
return bindingMode.twoWay;
}

Expand Down

0 comments on commit c952286

Please sign in to comment.