Skip to content

Commit

Permalink
cache attributes in codegen for model
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed May 26, 2017
1 parent e6fac6d commit fa90210
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,9 @@

specialDirectives["m-model"] = {
beforeGenerate: function (value, meta, vnode, parentVNode, dependencies) {
// Get attributes
var attrs = vnode.props.attrs;

// Compile a literal value for the getter
compileTemplateExpression(value, dependencies);

Expand All @@ -2281,7 +2284,7 @@
var valueProp = "value";

// If input type is checkbox, listen on 'change' and change the 'checked' dom property
if (vnode.props.attrs.type !== undefined && vnode.props.attrs.type.value === "checkbox") {
if (attrs.type !== undefined && attrs.type.value === "checkbox") {
eventType = "change";
valueProp = "checked";
}
Expand Down

0 comments on commit fa90210

Please sign in to comment.