Created
February 6, 2015 01:30
-
-
Save wuxiaoying/4dca547970982cb60bda to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is in PolymerExpressions prototype | |
prepareBinding: function(pathString, name, node) { | |
var path = Path.get(pathString); | |
if (!isLiteralExpression(pathString) && path.valid) { | |
if (path.length == 1) { | |
return function(model, node, oneTime) { | |
if (oneTime) | |
return path.getValueFrom(model); | |
var scope = findScope(model, path[0]); | |
return new PathObserver(scope, path); | |
}; | |
} | |
return; // bail out early if pathString is simple path. | |
} | |
return prepareBinding(pathString, name, node, this); | |
}, | |
// You can see that it passes itself into prepareBinding function as filterRegistry | |
function prepareBinding(expressionText, name, node, filterRegistry) { | |
var expression; | |
try { | |
expression = getExpression(expressionText); | |
if (expression.scopeIdent && | |
(node.nodeType !== Node.ELEMENT_NODE || | |
node.tagName !== 'TEMPLATE' || | |
(name !== 'bind' && name !== 'repeat'))) { | |
throw Error('as and in can only be used within <template bind/repeat>'); | |
} | |
} catch (ex) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment