src/audits/TableHasAppropriateHeaders.js
function isLayoutTable(element) {
        if (element.childElementCount == 0) {
            return true;
        }

        if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') {
            return false;
        }

        if (element.getAttribute('role') == 'presentation') {
            var tableChildren = element.querySelectorAll('*')

            // layout tables should only contain TR and TD elements
            for (var i = 0; i < tableChildren.length; i++) {
                if (tableChildren[i].tagName != 'TR' && tableChildren[i].tagName != 'TD') {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
function isLayoutTable(element) {
        if (element.childElementCount == 0) {
            return true;
        }

        if (element.hasAttribute('role') && element.getAttribute('role') != 'presentation') {
            return false;
        }

        if (element.getAttribute('role') == 'presentation') {
            var tableChildren = element.querySelectorAll('*')

            // layout tables should only contain TR and TD elements
            for (var i = 0; i < tableChildren.length; i++) {
                if (tableChildren[i].tagName != 'TR' && tableChildren[i].tagName != 'TD') {
                    return false;
                }
            }

            return true;
        }

        return false;
    }
function isLayoutTable ( element ) { if ( element . childElementCount == 0 ) { return true ; } if ( element . hasAttribute ( 'role' ) && element . getAttribute ( 'role' ) != 'presentation' ) { return false ; } if ( element . getAttribute ( 'role' ) == 'presentation' ) { var tableChildren = element . querySelectorAll ( '*' ) // layout tables should only contain TR and TD elements for ( var i = 0 ; i < tableChildren . length ; i ++ ) { if ( tableChildren [ i ] . tagName != 'TR' && tableChildren [ i ] . tagName != 'TD' ) { return false ; } } return true ; } return false ; }
Checks whether a table is a layout table.

@returns {boolean} Table is a layout table
Checks whether a table is a layout table .