function _populateMarkup() {
    // Add a container for our markup
    _containerDom = domCreate( 'div', {
      className: BASE_CLASS,
      around:    _dom
    } );

    // Create all our markup but wait to manipulate the DOM just once
    _selectionsDom = domCreate( 'ul', {
      className: 'list__unstyled ' + BASE_CLASS + '_choices',
      inside:    _containerDom
    } );

    _headerDom = domCreate( 'header', {
      className: BASE_CLASS + '_header'
    } );

    _searchDom = domCreate( 'input', {
      className:   BASE_CLASS + '_search',
      type:        'text',
      placeholder: _placeholder || 'Choose up to five',
      inside:      _headerDom,
      id:          _name
    } );

    _fieldsetDom = domCreate( 'fieldset', {
      'className':   BASE_CLASS + '_fieldset u-invisible',
      'aria-hidden': 'true'
    } );

    _optionsDom = domCreate( 'ul', {
      className: 'list__unstyled ' + BASE_CLASS + '_options',
      inside:    _fieldsetDom
    } );

    _optionsData.forEach( function( option ) {
      var _optionsItemDom = domCreate( 'li', {
        'data-option': option.value
      } );

      domCreate( 'input', {
        'id':     option.value,
        // Type must come before value or IE fails
        'type':    'checkbox',
        'value':   option.value,
        'name':    _name,
        'class':   'cf-input ' + BASE_CLASS + '_checkbox',
        'inside':  _optionsItemDom,
        'checked': option.checked
      } );

      domCreate( 'label', {
        'for':         option.value,
        'textContent': option.text,
        'className':   BASE_CLASS + '_label',
        'inside':      _optionsItemDom
      } );

      _optionsDom.appendChild( _optionsItemDom );

      if ( option.checked ) {
        var selectionsItemDom = domCreate( 'li', {
          'data-option': option.value
        } );

        domCreate( 'label', {
          'for':         option.value,
          'textContent': option.text,
          'className':   BASE_CLASS + '_label',
          'inside':      selectionsItemDom
        } );

        _selectionsDom.appendChild( selectionsItemDom );
        _selectionsCount += 1;
      }
    } );

    // Write our new markup to the DOM.
    _containerDom.appendChild( _headerDom );
    _containerDom.appendChild( _fieldsetDom );

    return _containerDom;
  }
/**
   * Populates and injects the markup for the custom multi-select.
   * @returns {HTMLNode} Newly created <div> element to hold the multiselect.
   */
Populates and injects the markup for the custom multi-select.
@returns {HTMLNode} Newly created  element to hold the multiselect.
Populates and injects the markup for the custom multi - select . @returns { HTMLNode } Newly created element to hold the multiselect .
function _populateMarkup() {
    _containerDom = domCreate( 'div', {
      className: BASE_CLASS,
      around:    _dom
    } );
    _selectionsDom = domCreate( 'ul', {
      className: 'list__unstyled ' + BASE_CLASS + '_choices',
      inside:    _containerDom
    } );
    _headerDom = domCreate( 'header', {
      className: BASE_CLASS + '_header'
    } );
    _searchDom = domCreate( 'input', {
      className:   BASE_CLASS + '_search',
      type:        'text',
      placeholder: _placeholder || 'Choose up to five',
      inside:      _headerDom,
      id:          _name
    } );
    _fieldsetDom = domCreate( 'fieldset', {
      'className':   BASE_CLASS + '_fieldset u-invisible',
      'aria-hidden': 'true'
    } );
    _optionsDom = domCreate( 'ul', {
      className: 'list__unstyled ' + BASE_CLASS + '_options',
      inside:    _fieldsetDom
    } );
    _optionsData.forEach( function( option ) {
      var _optionsItemDom = domCreate( 'li', {
        'data-option': option.value
      } );
      domCreate( 'input', {
        'id':     option.value,
        'type':    'checkbox',
        'value':   option.value,
        'name':    _name,
        'class':   'cf-input ' + BASE_CLASS + '_checkbox',
        'inside':  _optionsItemDom,
        'checked': option.checked
      } );
      domCreate( 'label', {
        'for':         option.value,
        'textContent': option.text,
        'className':   BASE_CLASS + '_label',
        'inside':      _optionsItemDom
      } );
      _optionsDom.appendChild( _optionsItemDom );
      if ( option.checked ) {
        var selectionsItemDom = domCreate( 'li', {
          'data-option': option.value
        } );
        domCreate( 'label', {
          'for':         option.value,
          'textContent': option.text,
          'className':   BASE_CLASS + '_label',
          'inside':      selectionsItemDom
        } );
        _selectionsDom.appendChild( selectionsItemDom );
        _selectionsCount += 1;
      }
    } );
    _containerDom.appendChild( _headerDom );
    _containerDom.appendChild( _fieldsetDom );
    return _containerDom;
  }
function _populateMarkup ( ) { _containerDom = domCreate ( 'div' , { className : BASE_CLASS , around : _dom } ) ; _selectionsDom = domCreate ( 'ul' , { className : 'list__unstyled ' + BASE_CLASS + '_choices' , inside : _containerDom } ) ; _headerDom = domCreate ( 'header' , { className : BASE_CLASS + '_header' } ) ; _searchDom = domCreate ( 'input' , { className : BASE_CLASS + '_search' , type : 'text' , placeholder : _placeholder || 'Choose up to five' , inside : _headerDom , id : _name } ) ; _fieldsetDom = domCreate ( 'fieldset' , { 'className' : BASE_CLASS + '_fieldset u-invisible' , 'aria-hidden' : 'true' } ) ; _optionsDom = domCreate ( 'ul' , { className : 'list__unstyled ' + BASE_CLASS + '_options' , inside : _fieldsetDom } ) ; _optionsData . forEach ( function ( option ) { var _optionsItemDom = domCreate ( 'li' , { 'data-option' : option . value } ) ; domCreate ( 'input' , { 'id' : option . value , 'type' : 'checkbox' , 'value' : option . value , 'name' : _name , 'class' : 'cf-input ' + BASE_CLASS + '_checkbox' , 'inside' : _optionsItemDom , 'checked' : option . checked } ) ; domCreate ( 'label' , { 'for' : option . value , 'textContent' : option . text , 'className' : BASE_CLASS + '_label' , 'inside' : _optionsItemDom } ) ; _optionsDom . appendChild ( _optionsItemDom ) ; if ( option . checked ) { var selectionsItemDom = domCreate ( 'li' , { 'data-option' : option . value } ) ; domCreate ( 'label' , { 'for' : option . value , 'textContent' : option . text , 'className' : BASE_CLASS + '_label' , 'inside' : selectionsItemDom } ) ; _selectionsDom . appendChild ( selectionsItemDom ) ; _selectionsCount += 1 ; } } ) ; _containerDom . appendChild ( _headerDom ) ; _containerDom . appendChild ( _fieldsetDom ) ; return _containerDom ; }
Populates and injects the markup for the custom multi-select.
Populates and injects the markup for the custom multi - select .
// Add a container for our markup // Create all our markup but wait to manipulate the DOM just once // Type must come before value or IE fails // Write our new markup to the DOM.