code format tweaks

This commit is contained in:
Hakim El Hattab 2016-10-05 12:00:21 +02:00
parent 7e99626b14
commit 02f95f4de6

View File

@ -554,21 +554,36 @@
}
/**
* Converts the given HTML element into a string of text
* that can be announced to a screen reader. Hidden
* elements are excluded.
*/
function getStatusText( node ) {
var text = "";
if(node.nodeType === 3) { //text node
var text = '';
// Text node
if( node.nodeType === 3 ) {
text += node.textContent;
}else if (node.nodeType === 1) { //element node
}
// Element node
else if( node.nodeType === 1 ) {
var isAriaHidden = node.getAttribute( 'aria-hidden' );
var isDisplayHidden = window.getComputedStyle( node )['display'] === 'none';
if( isAriaHidden !== 'true' && !isDisplayHidden ) {
var children = node.childNodes;
for (var i = 0;i < children.length; i++) {
text += getStatusText(children[i]);
}
toArray( node.childNodes ).forEach( function( child ) {
text += getStatusText( child );
} );
}
}
return text;
}
/**