Serialize tag attributes info

@inner
@param {Object} attributes tag attributes info
@param {Object} opts the serialize options
@return {string}
function serializeAttrs(attributes, opts) {
    if (!attributes) {
        return;
    }

    let output = '';
    let value;
    Object.keys(attributes).forEach(key => {
        value = attributes[key];
        if (output) {
            output += ' ';
        }

        let isBoolAttr = value && typeof value === 'boolean';
        if (isBoolAttr) {
            output += key;
        }
        else {
            output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
        }
    });

    return output;
}