diff --git a/additional/height-animation/toggle.js b/additional/height-animation/toggle.js index 23a1e63..6e1b0fa 100644 --- a/additional/height-animation/toggle.js +++ b/additional/height-animation/toggle.js @@ -1,70 +1,70 @@ - ;(function(document, window, undefined) { +;(function(document, window, undefined) { - 'use strict'; + 'use strict'; - if (!document.addEventListener || !('classList' in document.createElement('span'))) { // classList = IE11 - return; - } - - function widget_toggle(e) { - - var widget_ref = document.getElementById(this.getAttribute('aria-controls')); + if (!document.addEventListener || !('classList' in document.createElement('span'))) { // classList = IE11 + return; + } - if (widget_ref.getAttribute('aria-hidden') == 'true') { + function widget_toggle(e) { - this.setAttribute('aria-expanded', 'true'); - this.textContent = this.getAttribute('data-toggle-hidden'); + var widget_ref = document.getElementById(this.getAttribute('aria-controls')); - widget_ref.setAttribute('aria-hidden', 'false'); - widget_ref.focus(); + if (widget_ref.getAttribute('aria-hidden') == 'true') { - } else { + this.setAttribute('aria-expanded', 'true'); + this.textContent = this.getAttribute('data-toggle-hidden'); - this.setAttribute('aria-expanded', 'false'); - this.textContent = this.getAttribute('data-toggle-shown'); + widget_ref.setAttribute('aria-hidden', 'false'); + widget_ref.focus(); - widget_ref.setAttribute('aria-hidden', 'true'); + } else { - } + this.setAttribute('aria-expanded', 'false'); + this.textContent = this.getAttribute('data-toggle-shown'); - e.preventDefault(); + widget_ref.setAttribute('aria-hidden', 'true'); } - function init() { + e.preventDefault(); - var links = document.querySelectorAll('a[data-toggle-hidden]'), - widget_ref_id, - widget_ref; + } - for (var k = (links.length - 1); k >= 0; k--) { + function init() { - widget_ref_id = links[k].getAttribute('href').substr(1); - widget_ref = document.getElementById(widget_ref_id); + var links = document.querySelectorAll('a[data-toggle-hidden]'), + widget_ref_id, + widget_ref; - if (widget_ref) { + for (var k = (links.length - 1); k >= 0; k--) { - widget_ref.setAttribute('aria-hidden', 'true'); - widget_ref.setAttribute('tabindex', '-1'); - widget_ref.style.outline = 'none'; + widget_ref_id = links[k].getAttribute('href').substr(1); + widget_ref = document.getElementById(widget_ref_id); - links[k].setAttribute('data-toggle-shown', links[k].textContent); - links[k].setAttribute('role', 'button'); - links[k].setAttribute('aria-expanded', 'false'); - links[k].setAttribute('aria-controls', widget_ref_id); - links[k].addEventListener('click', widget_toggle); + if (widget_ref) { - } + widget_ref.setAttribute('aria-hidden', 'true'); + widget_ref.setAttribute('tabindex', '-1'); + widget_ref.style.outline = 'none'; + + links[k].setAttribute('data-toggle-shown', links[k].textContent); + links[k].setAttribute('role', 'button'); + links[k].setAttribute('aria-expanded', 'false'); + links[k].setAttribute('aria-controls', widget_ref_id); + links[k].addEventListener('click', widget_toggle); } } - if (document.readyState !== 'loading') { - window.setTimeout(init); // Handle asynchronously - } else { - document.addEventListener('DOMContentLoaded', init); - } + } + + if (document.readyState !== 'loading') { + window.setTimeout(init); // Handle asynchronously + } else { + document.addEventListener('DOMContentLoaded', init); + } - })(document, window); +})(document, window);