Apparently the derived element uses the wrong bind method. Overriding bind
and explicitly calling HTMLElement.prototype.bind solves the problem. Seems
to be some bug in CustomElements.
<polymer-element name="fast-input" extends="input" touch-action="none"
on-tap="{{ tap }}" on-mousedown="{{ mousedown }}">
<script>
Polymer("fast-input", {
tap: function(event) {
this.setSelectionRange(this.value.length,
this.value.length);
},
mousedown: function() {
event.preventDefault();
},
bind: function() {
return HTMLInputElement.prototype.bind.apply(this,
arguments);
}
});
</script>
</polymer-element>
On Wednesday, January 8, 2014 9:30:36 PM UTC+1, Martin Kleinschrodt wrote:
>
> So I've created this custom input element to get rid of the 300ms
> focussing delay when tapping into an input element on mobile:
>
> <polymer-element name="fast-input" extends="input" touch-action="none"
> on-tap="{{ tap }}" on-mousedown="{{ mousedown }}">
> <script>
> Polymer("fast-input", {
> tap: function(event) {
> this.setSelectionRange(this.value.length,
> this.value.length);
> },
> mousedown: function() {
> event.preventDefault();
> }
> });
> </script>
> </polymer-element>.
>
> This works fine. Unfortunately, using a custom extension of the input
> element seems to mess with data binding. So this
>
> <input is="fast-input" value="{{ myValue }}" />
> <div>{{ myValue }}</div>
>
> does no longer work.
>
> Is this a bug or am I doing something wrong?
>
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.