function makeTagAttribs(attribs) {
            var quoteChar = '"';
            if (attribs) {
                var fields = Object.keys(attribs).map(function (key) {
                    var value = attribs[key],
                        attribName = camelToHyphen(key);
                    if (typeof value === 'object') {
                        switch (attribName) {
                            case 'style':
                                value = makeStyleAttribs(value);
                                break;
                            case 'data-bind':
                                // reverse the quote char, since data-bind attributes 
                                // can contain double-quote, which can't itself
                                // be quoted.
                                quoteChar = "'";
                                value = makeDataBindAttribs(value);
                                break;
                        }
                    }
                    if (typeof value === 'string') {
                        var escapedValue = value.replace(new RegExp('\\' + quoteChar, 'g'), '\\' + quoteChar);
                        return attribName + '=' + quoteChar + escapedValue + quoteChar;
                    } else if (typeof value === 'boolean') {
                        if (value) {
                            return attribName;
                        }
                    } else if (typeof value === 'number') {
                        return attribName + '=' + quoteChar + String(value) + quoteChar;
                    }
                    return false;
                });
                return fields.filter(function (field) {
                    return field ? true : false;
                }).join(' ');
            } else {
                return '';
            }
        }
/**
         * Given a simple object of keys and values, create a string which 
         * encodes a set of html tag attributes.
         * String values escape the "
         * Boolean values either insert the attribute name or not
         * Object values are interpreted as "embedded attributes" (see above)
         * @param {type} attribs
         * @returns {String}
         */
Given a simple object of keys and values, create a string which
encodes a set of html tag attributes.
String values escape the "
Boolean values either insert the attribute name or not
Object values are interpreted as "embedded attributes"
@param {type} attribs
@returns {String}
Given a simple object of keys and values create a string which encodes a set of html tag attributes . String values escape the " Boolean values either insert the attribute name or not Object values are interpreted as " embedded attributes " @param { type } attribs @returns { String }
function makeTagAttribs(attribs) {
            var quoteChar = '"';
            if (attribs) {
                var fields = Object.keys(attribs).map(function (key) {
                    var value = attribs[key],
                        attribName = camelToHyphen(key);
                    if (typeof value === 'object') {
                        switch (attribName) {
                            case 'style':
                                value = makeStyleAttribs(value);
                                break;
                            case 'data-bind':
                                quoteChar = "'";
                                value = makeDataBindAttribs(value);
                                break;
                        }
                    }
                    if (typeof value === 'string') {
                        var escapedValue = value.replace(new RegExp('\\' + quoteChar, 'g'), '\\' + quoteChar);
                        return attribName + '=' + quoteChar + escapedValue + quoteChar;
                    } else if (typeof value === 'boolean') {
                        if (value) {
                            return attribName;
                        }
                    } else if (typeof value === 'number') {
                        return attribName + '=' + quoteChar + String(value) + quoteChar;
                    }
                    return false;
                });
                return fields.filter(function (field) {
                    return field ? true : false;
                }).join(' ');
            } else {
                return '';
            }
        }
function makeTagAttribs ( attribs ) { var quoteChar = '"' ; if ( attribs ) { var fields = Object . keys ( attribs ) . map ( function ( key ) { var value = attribs [ key ] , attribName = camelToHyphen ( key ) ; if ( typeof value === 'object' ) { switch ( attribName ) { case 'style' : value = makeStyleAttribs ( value ) ; break ; case 'data-bind' : quoteChar = "'" ; value = makeDataBindAttribs ( value ) ; break ; } } if ( typeof value === 'string' ) { var escapedValue = value . replace ( new RegExp ( '\\' + quoteChar , 'g' ) , '\\' + quoteChar ) ; return attribName + '=' + quoteChar + escapedValue + quoteChar ; } else if ( typeof value === 'boolean' ) { if ( value ) { return attribName ; } } else if ( typeof value === 'number' ) { return attribName + '=' + quoteChar + String ( value ) + quoteChar ; } return false ; } ) ; return fields . filter ( function ( field ) { return field ? true : false ; } ) . join ( ' ' ) ; } else { return '' ; } }
Given a simple object of keys and values, create a string which
 encodes a set of html tag attributes.
Given a simple object of keys and values create a string which encodes a set of html tag attributes .
// reverse the quote char, since data-bind attributes  // can contain double-quote, which can't itself // be quoted.