You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 10, 2020. It is now read-only.
Thanks to @rodneyrehm there is an improved version of the script that supports dynamically adding of elements (in the jQuery version). I think that is an awesome addition to the script. Code for future reference:
(function($,undefined){$.accessifyHtml5=function(options){varselectors=$.accessifyHtml5.defaults;// import special selectors (if they're known to $.accessifyHtml5.special)if(options){// "clone" default map for we don't want it mutatedselectors=$.extend(true,{},$.accessifyHtml5.defaults);$.each(options,function(key,selector){if($.accessifyHtml5.special[key]){// replace key by the given selector, import attributes from .specialselectors[selector]=$.accessifyHtml5.special[key];}});}// apply attributes$.each(selectors,function(selector,attrs){$(selector).attr(attrs);});returnthis;};// 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]';// default selectors$.accessifyHtml5.defaults={'article' : {'role': 'article'},'aside' : {'role': 'complementary'},'nav' : {'role': 'navigation'},'output' : {'aria-live': 'polite'},'section' : {'role': 'region'},'[required]' : {'aria-required': 'true'}};// register DOMNodeInserted listener at onDomReady so you have a chance to disable it$(function(){if(!$.accessifyHtml5.selector){return;}$(document.body).on('DOMNodeInserted',$.accessifyHtml5.selector,function(e){var$this=$(this);$.each($.accessifyHtml5.defaults,function(selector,attr){if($this.is(selector)){$this.attr(attr);returnfalse;}returntrue;});});});// expose old accessorwindow.AccessifyHTML5=$.accessifyHtml5;})(jQuery);
Thanks to @rodneyrehm there is an improved version of the script that supports dynamically adding of elements (in the jQuery version). I think that is an awesome addition to the script. Code for future reference: