ax1 / iridiumjs

🚀 Boost HTML horsepower
MIT License
1 stars 0 forks source link

check if pipes in onclick are executing the functions (instead of creating the function call) #19

Open ax1 opened 6 years ago

ax1 commented 6 years ago

Example: onclick='{{allowDrag(id)}}' executes fn('id') (as properly stated in documentation for several use cases is handy...)

but FIRST, it is an edge case (everybody would spect the id value not the key, and if only useful for arrays, probably iti s better to think about solve the edge case in arrays instead of leaving that "special case"

SECOND, if we use the alternative of pipes to set the value, the execution appears to call the function instead of rewrite the call. A simple test is to repaint the controller and if piping in an onclick method, the code is executed and it shouldn't

so check that

<button onclick='{{allowDrag(id)}}'>pin / unpin</button>
       <button title="show recent positions of the sensor" class='btn btn-link btn-sm' <button onclick='{{id|showHideTrack}}'>track / untrack</button>

the first one obliges to get the id as allowDrag: function(key){ const id =this.model.get(key)

and the second option executes when read() and not when click

Marked as bug because even if feature is properly implemented, it is not what a greenhorn developer would expect.