src/aria/widgets/form/CheckBox.js
function (hasIds, visible) {
            var cfg = this._cfg;
            var waiAria = cfg.waiAria;
            var markup = ['<input type="', cfg._inputType, '"', ' value="', cfg.value, '"'];
            var checked = this._isChecked();
            if (checked) {
                markup.push(' checked');
            }
            markup.push(visible ? ' style="display:inline-block"' : ' class="xSROnly"');
            if (hasIds) {
                var inputName = this._inputName;
                if (inputName) {
                    markup.push(' name="', inputName, '"');
                }
                if (Aria.testMode || waiAria) {
                    markup.push(' id="' + this._domId + '_input"');
                }
                if (waiAria) {
                    markup.push(this._getAriaLabelMarkup());
                }
            } else if (waiAria) {
                markup.push(' aria-hidden="true"');
            }
            if (cfg.disabled) {
                if (visible || !this._hasWaiWorkaroundMarkup) {
                    markup.push(' disabled');
                } else /* if (!visible && this._hasWaiWorkaroundMarkup) */ {
                    // This is the work-around: using aria-disabled and omitting the disabled attribute
                    markup.push(' aria-disabled="true"');
                    // to prevent the widget from being focusable by tab, we use tabindex="-1":
                    markup.push(' tabindex="-1"');
                }
            } else {
                markup.push(' tabindex="', this._calculateTabIndex(), '"');
            }
            markup.push('/>');
            return markup.join('');
        }
function (hasIds, visible) {
            var cfg = this._cfg;
            var waiAria = cfg.waiAria;
            var markup = ['<input type="', cfg._inputType, '"', ' value="', cfg.value, '"'];
            var checked = this._isChecked();
            if (checked) {
                markup.push(' checked');
            }
            markup.push(visible ? ' style="display:inline-block"' : ' class="xSROnly"');
            if (hasIds) {
                var inputName = this._inputName;
                if (inputName) {
                    markup.push(' name="', inputName, '"');
                }
                if (Aria.testMode || waiAria) {
                    markup.push(' id="' + this._domId + '_input"');
                }
                if (waiAria) {
                    markup.push(this._getAriaLabelMarkup());
                }
            } else if (waiAria) {
                markup.push(' aria-hidden="true"');
            }
            if (cfg.disabled) {
                if (visible || !this._hasWaiWorkaroundMarkup) {
                    markup.push(' disabled');
                } else /* if (!visible && this._hasWaiWorkaroundMarkup) */ {
                    // This is the work-around: using aria-disabled and omitting the disabled attribute
                    markup.push(' aria-disabled="true"');
                    // to prevent the widget from being focusable by tab, we use tabindex="-1":
                    markup.push(' tabindex="-1"');
                }
            } else {
                markup.push(' tabindex="', this._calculateTabIndex(), '"');
            }
            markup.push('/>');
            return markup.join('');
        }
function ( hasIds , visible ) { var cfg = this . _cfg ; var waiAria = cfg . waiAria ; var markup = [ '<input type="' , cfg . _inputType , '"' , ' value="' , cfg . value , '"' ] ; var checked = this . _isChecked ( ) ; if ( checked ) { markup . push ( ' checked' ) ; } markup . push ( visible ? ' style="display:inline-block"' : ' class="xSROnly"' ) ; if ( hasIds ) { var inputName = this . _inputName ; if ( inputName ) { markup . push ( ' name="' , inputName , '"' ) ; } if ( Aria . testMode || waiAria ) { markup . push ( ' id="' + this . _domId + '_input"' ) ; } if ( waiAria ) { markup . push ( this . _getAriaLabelMarkup ( ) ) ; } } else if ( waiAria ) { markup . push ( ' aria-hidden="true"' ) ; } if ( cfg . disabled ) { if ( visible || ! this . _hasWaiWorkaroundMarkup ) { markup . push ( ' disabled' ) ; } else /* if (!visible && this._hasWaiWorkaroundMarkup) */ { // This is the work-around: using aria-disabled and omitting the disabled attribute markup . push ( ' aria-disabled="true"' ) ; // to prevent the widget from being focusable by tab, we use tabindex="-1": markup . push ( ' tabindex="-1"' ) ; } } else { markup . push ( ' tabindex="' , this . _calculateTabIndex ( ) , '"' ) ; } markup . push ( '/>' ) ; return markup . join ( '' ) ; }
Returns the markup of an input element representing the current state of the widget.
@param {Boolean} hasIds Whether the input should have a name and ids (if configured so).
@param {Boolean} visible Whether the input should be visible (or have the xSROnly class)
@return {String}
Returns the markup of an input element representing the current state of the widget .