heppokofrontend/jquery-accessible-name

View on GitHub
lib/jquery.accessibleName.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*!
 * @heppokofrontend/jquery-accessible-name v0.1.2
 * author: heppokofrontend <heppokofrontend@gmail.com> (https://github.com/heppokofrontend)
 * license: MIT
 */
!function(){"use strict";window.jQuery&&(window.jQuery.fn.a11yName=function(){const t=[];return this.each((function(){var n;t.push((t=>{const n=t.getAttribute("aria-labelledby");if(!n)return null;const e=n.split(/\s/),r=[];for(const t of e){const n=document.getElementById(t);n&&r.push((n.textContent||"").trim())}return r.join(" ")})(n=this)??n.getAttribute("aria-label")??(t=>{const n=t.labels;return n&&n.length?Array.prototype.map.call(n,(t=>(t.textContent||"").trim())).join(" "):null})(n)??n.title)})),t.join("").trim()})}();