-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing a DOM attribute doesn't change the model #246
Comments
We multiplexed the {{ }} syntax to support two different forms of binding.
Is a DOM binding: it's a one-way binding of IFF
is interpreted as a direct property binding between This multiplexing is designed to reduce cognitive load on users: there is one syntax for binding. Whether that's the right trade-off is open for discussion. |
How does |
Yes, my "IFF" was not correct. Short answer, Long answer: individual nodes get to decide what to do with mustache syntax via the
All polymer-elements override the Ultimately, any element could have a |
Makes sense. Thank you for the explanation! I'm going to close this bug, but it might help future developers understand if this information was captured in the documentation somewhere. |
I'm still confused here...why doesn't the following case work as I expect it to? <!DOCTYPE html>
<script src="third_party/polymer/polymer.js"></script>
<polymer-element name="rietveld-app">
<template>
<rietveld-issuelist selected="{{ number }}"></rietveld-issuelist>
<rietveld-issue number="{{ number }}"></rietveld-issue>
</template>
<script>
Polymer('rietveld-app', {
ready: function() {
this.number = 'initial';
}
});
</script>
</polymer-element>
<polymer-element name="rietveld-issuelist" attributes="selected">
<template>
<div on-tap="selectIssue">tap me {{ selected }}</div>
</template>
<script>
Polymer('rietveld-issuelist', {
selectIssue: function(event) {
this.selected = "changed";
}
});
</script>
</polymer-element>
<polymer-element name="rietveld-issue" attributes="number">
<template>This should change to "changed" after the tap: {{ number }}</template>
<script>
Polymer('rietveld-issue', {});
</script>
</polymer-element>
<rietveld-app></rietveld-app> |
It's a dependency ordering problem. Even though the dependency ordering is not correct here, there's a more When This is good candidate for a warning message and I've posted this issue to On Sat, Aug 24, 2013 at 1:43 PM, ojanvafai notifications@github.com wrote:
|
I'm not sure whether this behavior is expected, but it surprised me. I would expect that setting a DOM attribute would mutate the model value wired up to that attribute, like it does for custom elements.
For the test case below, I see "PASS (2 of 2)" displayed but not "PASS (1 of 2)". That indicates that changing the custom element's attribute mutated the model but that changing a regular element's attribute did not mutate the model.
The text was updated successfully, but these errors were encountered: