AccessifyHTML5 - improved

Some improvements to AccessifyHTML5

HTML

<button id="add-output">add output</button>

CSS

body { padding: 2em; }
form {
    background: #ddd;
    margin: 0 0 1em;
    padding: 1em;
}
[role=search] { background: #bada55; }

JavaScript

/*
 * Accessifyhtml5.js
 *
 * Source: https://github.com/yatil/accessifyhtml5.js
 */
(function($, undefined){
    
    $.accessifyHtml5 = function(options) {
        var selectors = $.accessifyHtml5.defaults;
        
        // import special selectors (if they're known to $.accessifyHtml5.special)
        if (options) {
            // "clone" default map for we don't want it mutated
            selectors = $.extend(true, {}, $.accessifyHtml5.defaults);
            $.each(options, function(key, selector) {
                if ($.accessifyHtml5.special[key]) {
                    // replace key by the given selector, import attributes from .special
                    selectors[selector] = $.accessifyHtml5.special[key];
                }
            });
        }

        // apply attributes
        $.each(selectors, function(selector, attrs){
            $(selector).attr(attrs);
        });

        return this;
    };
    
    // list of elements to be replaced by a given selector in options to $.accessifyHtml5()
    $.accessifyHtml5.special = {
        'header'        : { 'role':          'banner'        },
        'footer'        : { 'role':          'contentinfo'   },
        'main'          : { 'role':          'main'          }
    };
    // selector to update upon dom node creation
    $.accessifyHtml5.selector = 'article, aside, nav, output, section, [required], form:has(input[type="search"])';

    // default selectors
    $.accessifyHtml5.defaults = {
        'article'       : { 'role':          'article'       },
        'aside'         : { 'role':          'complementary' },
        'nav'           : { 'role':          'navigation'    },
        'output'        : { 'aria-live':     'polite'        },
        'section'       : { 'role':          'region'        },
        '[required]'    : { 'aria-required': 'true'          },
        'form:has(input[type="search"])'    : { 'role':          'search'        }
    };
    
    // register DOMNodeInserted...