src/bind.js
function radio(bind, el, param, value) {
  var group = element('span', {'class': RadioClass});

  el.appendChild(group);

  bind.elements = param.options.map(function(option) {
    var id = OptionClass + param.signal + '-' + option;

    var attr = {
      id:    id,
      type:  'radio',
      name:  param.signal,
      value: option
    };
    if (valuesEqual(option, value)) attr.checked = true;

    var input = element('input', attr);

    input.addEventListener('change', function() {
      bind.update(option);
    });

    group.appendChild(input);
    group.appendChild(element('label', {'for': id}, option+''));

    return input;
  });

  bind.set = function(value) {
    var nodes = bind.elements,
        i = 0,
        n = nodes.length;
    for (; i<n; ++i) {
      if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;
    }
  };
}
function radio(bind, el, param, value) {
  var group = element('span', {'class': RadioClass});

  el.appendChild(group);

  bind.elements = param.options.map(function(option) {
    var id = OptionClass + param.signal + '-' + option;

    var attr = {
      id:    id,
      type:  'radio',
      name:  param.signal,
      value: option
    };
    if (valuesEqual(option, value)) attr.checked = true;

    var input = element('input', attr);

    input.addEventListener('change', function() {
      bind.update(option);
    });

    group.appendChild(input);
    group.appendChild(element('label', {'for': id}, option+''));

    return input;
  });

  bind.set = function(value) {
    var nodes = bind.elements,
        i = 0,
        n = nodes.length;
    for (; i<n; ++i) {
      if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true;
    }
  };
}
function radio ( bind , el , param , value ) { var group = element ( 'span' , { 'class' : RadioClass } ) ; el . appendChild ( group ) ; bind . elements = param . options . map ( function ( option ) { var id = OptionClass + param . signal + '-' + option ; var attr = { id : id , type : 'radio' , name : param . signal , value : option } ; if ( valuesEqual ( option , value ) ) attr . checked = true ; var input = element ( 'input' , attr ) ; input . addEventListener ( 'change' , function ( ) { bind . update ( option ) ; } ) ; group . appendChild ( input ) ; group . appendChild ( element ( 'label' , { 'for' : id } , option + '' ) ) ; return input ; } ) ; bind . set = function ( value ) { var nodes = bind . elements , i = 0 , n = nodes . length ; for ( ; i < n ; ++ i ) { if ( valuesEqual ( nodes [ i ] . value , value ) ) nodes [ i ] . checked = true ; } } ; }
Generates a radio button group.
Generates a radio button group .