src/aria/ext/StressCss.js
function (incremental) {
        if (!reportHolder || !results) {
            return; // logging was not enabled
        }

        var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>';

        // Extract the 10 slowest results
        var resultsArray = [];
        for (var res in results) {
            if (results.hasOwnProperty(res) && res !== "__baseline__") {
                resultsArray.push(results[res]);
            }
        }
        var sorted = resultsArray.sort(function (a, b) {
            if (a.baseline === b.baseline) {
                return 0;
            }

            if (incremental) {
                return a.baseline > b.baseline ? 1 : -1;
            } else {
                return a.baseline > b.baseline ? -1 : 1;
            }
        }).slice(0, 20);

        for (var i = 0, len = sorted.length; i < len; i += 1) {
            var item = sorted[i];
            table += '<tr><td style="font:11px monospace">Removing <strong>'
                    + item.name
                    + '</strong></td><td style="text-align:right">'
                    + (item.baseline > 0
                            ? '<span style="color:green">saves</span>'
                            : '<span style="color:red">adds</span>')
                    + '</td><td style="text-align:right; font:11px monospace">' + Math.abs(item.baseline) + 'ms</td>'
                    + '<td style="text-align:right; font:11px monospace">' + item.runTime + 'ms</td></tr>\n';
        }

        table += '</tbody></table><hr/>';

        // Summary
        table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">'
                + resultsArray.length
                + '</td></tr>'
                + '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">'
                + results["__baseline__"].runTime + 'ms</td></tr>';

        style(reportHolder, {
            width : 600
        });

        logHolder.innerHTML = table;
    }
function (incremental) {
        if (!reportHolder || !results) {
            return; // logging was not enabled
        }

        var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>';

        // Extract the 10 slowest results
        var resultsArray = [];
        for (var res in results) {
            if (results.hasOwnProperty(res) && res !== "__baseline__") {
                resultsArray.push(results[res]);
            }
        }
        var sorted = resultsArray.sort(function (a, b) {
            if (a.baseline === b.baseline) {
                return 0;
            }

            if (incremental) {
                return a.baseline > b.baseline ? 1 : -1;
            } else {
                return a.baseline > b.baseline ? -1 : 1;
            }
        }).slice(0, 20);

        for (var i = 0, len = sorted.length; i < len; i += 1) {
            var item = sorted[i];
            table += '<tr><td style="font:11px monospace">Removing <strong>'
                    + item.name
                    + '</strong></td><td style="text-align:right">'
                    + (item.baseline > 0
                            ? '<span style="color:green">saves</span>'
                            : '<span style="color:red">adds</span>')
                    + '</td><td style="text-align:right; font:11px monospace">' + Math.abs(item.baseline) + 'ms</td>'
                    + '<td style="text-align:right; font:11px monospace">' + item.runTime + 'ms</td></tr>\n';
        }

        table += '</tbody></table><hr/>';

        // Summary
        table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">'
                + resultsArray.length
                + '</td></tr>'
                + '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">'
                + results["__baseline__"].runTime + 'ms</td></tr>';

        style(reportHolder, {
            width : 600
        });

        logHolder.innerHTML = table;
    }
function ( incremental ) { if ( ! reportHolder || ! results ) { return ; // logging was not enabled } var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>' ; // Extract the 10 slowest results var resultsArray = [ ] ; for ( var res in results ) { if ( results . hasOwnProperty ( res ) && res !== "__baseline__" ) { resultsArray . push ( results [ res ] ) ; } } var sorted = resultsArray . sort ( function ( a , b ) { if ( a . baseline === b . baseline ) { return 0 ; } if ( incremental ) { return a . baseline > b . baseline ? 1 : - 1 ; } else { return a . baseline > b . baseline ? - 1 : 1 ; } } ) . slice ( 0 , 20 ) ; for ( var i = 0 , len = sorted . length ; i < len ; i += 1 ) { var item = sorted [ i ] ; table += '<tr><td style="font:11px monospace">Removing <strong>' + item . name + '</strong></td><td style="text-align:right">' + ( item . baseline > 0 ? '<span style="color:green">saves</span>' : '<span style="color:red">adds</span>' ) + '</td><td style="text-align:right; font:11px monospace">' + Math . abs ( item . baseline ) + 'ms</td>' + '<td style="text-align:right; font:11px monospace">' + item . runTime + 'ms</td></tr>\n' ; } table += '</tbody></table><hr/>' ; // Summary table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">' + resultsArray . length + '</td></tr>' + '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">' + results [ "__baseline__" ] . runTime + 'ms</td></tr>' ; style ( reportHolder , { width : 600 } ) ; logHolder . innerHTML = table ; }
Log the CSS stress test results in the report holder
@param {Boolean} incremental Type of test. If incremental we are interested in the selectors that make us waste
more, otherwise in the ones that make us gain more
Log the CSS stress test results in the report holder