text: 'use strict';
  
  var Concur = require('Concur')
  var object = require('isomorph/object')
  
  /**
   * Some widgets are made of multiple HTML elements -- namely, RadioSelect.
   * This represents the "inner" HTML element of a widget.
   * @constructor
   */
  var SubWidget = Concur.extend({
    constructor: function SubWidget(parentWidget, name, value, kwargs) {
      if (!(this instanceof SubWidget)) {
        return new SubWidget(parentWidget, name, value, kwargs)
      }
      this.parentWidget = parentWidget
      this.name = name
      this.value = value
      kwargs = object.extend({attrs: null, choices: []}, kwargs)
      this.attrs = kwargs.attrs
      this.choices = kwargs.choices
    }
  })
  
  SubWidget.prototype.render = function() {
    var kwargs = {attrs: this.attrs}
    if (this.choices.length) {
      kwargs.choices = this.choices
    }
    return this.parentWidget.render(this.name, this.value, kwargs)
  }
  
  module.exports = SubWidget