-
Notifications
You must be signed in to change notification settings - Fork 42
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
Feature Request: Add support for linking to arbitrary DOM attributes and element content instead of just form element values. #5
Comments
I wholeheartedly agree on both points. This is great; could be less restrictive. As it is, we still need to separately script the "linking" of an object with non-input elements and attributes. |
As it is, the link() API can be used with atttributes and elements through the use of a custom convertBack converter. The converter then takes the responsibility of setting attribute and element values when invoked. Both the value and the target DOM element is passed into the converter, so it is easy to to, just not obvious or succinct. |
Took me hours to figure out that currently only elements that are read and set by "val" are supported. Instead of doing it this way I just added some logic that identifies the element type (tag) and uses the right field name based on that. |
This only solves part of the problem however. As I have described in a comment in the code elements 'a' and 'img' do have multiple values that one would want to bind to like the link/image text as well as the href/src. |
Currently, the link() method (as documented and as functions) only supports linking to form input elements. While this is good for simple scenarios, it does not support rich applications that update automatically based on user input. Ideally you should be able to link to arbitrary attributes, such as the url of an IMG element, or the content of a SPAN element, and have these update as changes are made to the source javascript object.
The text was updated successfully, but these errors were encountered: