Removing table headers for print

JavaScript performance comparison

Test case created by James C

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

    

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
JavaScript - remove header
var theadList = document.getElementsByTagName("thead");
            for(i = 0;i < theadList.length; i++)
            {
                var theadElement = theadList[i];
                var theadParentElement = theadElement.parentNode;
                var theadInnerHtml = theadElement.innerHTML;
                var tbody = document.createElement("tbody");
                tbody.innerHTML = theadInnerHtml;
                    if (theadElement.className =="executedLoop") {
                        //do nothing
                    } else {
                        theadElement.className += "executedLoop";
                        theadParentElement.insertBefore(tbody, theadElement);
                        theadElement.style.display="none";
                    }
        
            }
pending…
jQuery - remove header
var theadList = document.getElementsByTagName("thead");
    for(i = 0;i < theadList.length; i++)
    {
        var theadElement = theadList[i];
        var theadParentElement = theadElement.parentNode;
        var theadInnerHtml = theadElement.innerHTML;
        var tbody = document.createElement("tbody");
        tbody.innerHTML = theadInnerHtml;
        theadParentElement.insertBefore(tbody, theadElement);
    }
$('thead').remove();
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments