googlearchive / core-input

A single-line text field with some extra powers
7 stars 20 forks source link

Should committedValue use "checked" instead of "value"? #65

Open masaoliou opened 9 years ago

masaoliou commented 9 years ago

Value of committedValue never changes by mouse clicks while value of checked does, as shown by console.log. Maybe committedValue should use property checked instead of value when type is checkbox. No?

    <!DOCTYPE html>
    <html>
    <head>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <script src="webcomponentsjs/webcomponents.min.js"></script>
    <link rel="import" href="core-input/core-input.html">
    </head>
    <body>
        <template id="i" is="auto-binding" repeat="{{c in inputs}}">
            <input is="core-input" type="checkbox" value="{{c}}" checked?="{{c}}" on-change="{{change}}">
        </template>
        <script>
            var i = document.querySelector('#i');
            i.inputs = [true,false];
            i.change = function(e){
                alert(e.target.value+","+e.target.committedValue+","+e.target.checked);
            }
        </script>
    </body>
    </html>