src/aria/utils/Accessibility.js
function (text, options) {
            // -------------------------------------- input arguments processing

            var document = Aria.$window.document;

            if (options == null) {
                options = {};
            }

            var parent = options.parent;
            if (parent == null) {
                parent = document.body;
            }

            var alert = options.alert;

            // ------------------------------------------------------ processing

            var waiReadTextElt = document.createElement("span");
            waiReadTextElt.className = "xSROnly";
            waiReadTextElt.setAttribute("role", alert ? "alert" : "status");
            waiReadTextElt.setAttribute("aria-live", "assertive");
            waiReadTextElt.setAttribute("aria-relevant", "additions");
            if (alert) {
                waiReadTextElt.style.visibility = "hidden";
            }
            parent.appendChild(waiReadTextElt);

            var textChild = document.createElement("span");
            var textNode = document.createTextNode(text);
            textChild.appendChild(textNode);
            waiReadTextElt.appendChild(textChild);

            if (alert) {
                waiReadTextElt.style.visibility = "visible";
            }

            setTimeout(function () {
                // remove the node after 10ms
                ariaUtilsDom.removeElement(waiReadTextElt);
            }, 10);
        }
function (text, options) {
            // -------------------------------------- input arguments processing

            var document = Aria.$window.document;

            if (options == null) {
                options = {};
            }

            var parent = options.parent;
            if (parent == null) {
                parent = document.body;
            }

            var alert = options.alert;

            // ------------------------------------------------------ processing

            var waiReadTextElt = document.createElement("span");
            waiReadTextElt.className = "xSROnly";
            waiReadTextElt.setAttribute("role", alert ? "alert" : "status");
            waiReadTextElt.setAttribute("aria-live", "assertive");
            waiReadTextElt.setAttribute("aria-relevant", "additions");
            if (alert) {
                waiReadTextElt.style.visibility = "hidden";
            }
            parent.appendChild(waiReadTextElt);

            var textChild = document.createElement("span");
            var textNode = document.createTextNode(text);
            textChild.appendChild(textNode);
            waiReadTextElt.appendChild(textChild);

            if (alert) {
                waiReadTextElt.style.visibility = "visible";
            }

            setTimeout(function () {
                // remove the node after 10ms
                ariaUtilsDom.removeElement(waiReadTextElt);
            }, 10);
        }
function ( text , options ) { // -------------------------------------- input arguments processing var document = Aria . $window . document ; if ( options == null ) { options = { } ; } var parent = options . parent ; if ( parent == null ) { parent = document . body ; } var alert = options . alert ; // ------------------------------------------------------ processing var waiReadTextElt = document . createElement ( "span" ) ; waiReadTextElt . className = "xSROnly" ; waiReadTextElt . setAttribute ( "role" , alert ? "alert" : "status" ) ; waiReadTextElt . setAttribute ( "aria-live" , "assertive" ) ; waiReadTextElt . setAttribute ( "aria-relevant" , "additions" ) ; if ( alert ) { waiReadTextElt . style . visibility = "hidden" ; } parent . appendChild ( waiReadTextElt ) ; var textChild = document . createElement ( "span" ) ; var textNode = document . createTextNode ( text ) ; textChild . appendChild ( textNode ) ; waiReadTextElt . appendChild ( textChild ) ; if ( alert ) { waiReadTextElt . style . visibility = "visible" ; } setTimeout ( function ( ) { // remove the node after 10ms ariaUtilsDom . removeElement ( waiReadTextElt ) ; } , 10 ) ; }
Forces the screen reader to read the given piece of text.

<p>The options object can contain the following properties: </p>
<ul>
<li><em>parent</em>: the DOM element in which to put the temporarily generated element</li>
<li><em>alert</em>: whether or not to treat the generated element as an alert (role = "alert" instead of "status")</li>
</ul>

@param {String} text The text to be read
@param {Object} options Optional options object, see description for more information.
Forces the screen reader to read the given piece of text .