Closed sany98215 closed 4 years ago
version 1.0.2 . when prop change to Perter***, input element do not change to select
Thanks for this. I'm travelling for the rest of June, so may not be able to look closer at this until I return...
I created this fiddle to give a shorter demonstration of the problem.
Type into the textbox with the console open. You'll see that 'b' is logged each time you type something but 'a' is only logged on initial rendering. I believe that jsviews might incorrectly be treating the .startsWith...
expression as a property path and is monitoring it for changes instead of the test property.
Thanks very much for beginning to look into this!
Yes, I agree with your explanation, Johan, and in fact for it to work as intended you have to write test^startsWith(...)
.
I think that it actually makes sense to require that syntax if you want to 'observe' changes to test
. For any property path a.b.c.d
or a().b().c().d()
or some mixture a.b().c.d()
it should make no difference whether they are objects or strings and whether the 'members' are instance properties or prototype members. And those with parens may be simple functions, or computed properties, with depends etc.
Either way you are listening to leaf changes only, unless you use the ^
separator.
I appreciate that people may expect test.startsWith() to 'listen' to changes in the test
string, but to introduce special behavior no longer based on the syntactical rules, but instead based on detecting that test
is a string and startsWith()
is in the String prototype, could be difficult to implement, buggy, and unpredictable in behavior....
That's my initial take. What do you think?
BTW another simple test case would be:
<input data-link="test" />
{^{:test^indexOf('a') }}
Thanks for your reply.I understand what is it.
OK - I'll close this.