馃悰 Fix HTML report sorting order storage in jQuery unload event by tiangolo 路 Pull Request #1066 路 nedbat/coveragepy (original) (raw)

馃悰 Fix HTML report sorting order storage in jQuery unload event.

This is related to: #986

I'm having a (probably) similar issue. In the generated HTML report, on the console, I'm seeing an error:

Uncaught TypeError: $(...).unload is not a function
    at HTMLDocument.coverage.index_ready (coverage_html.js:227)
    at mightThrow (jquery.min.js:2)
    at process (jquery.min.js:2)

Using $().unload was deprecated and removed in jQuery 3. The recommendation is to use $().on("unload", handler).

I see that it seems the included minified jQuery JS file says it has version 1.11: https://github.com/nedbat/coveragepy/blob/master/coverage/htmlfiles/jquery.min.js#L1

Nevertheless, when I generate an HTML report from scratch in a local project, the minified jQuery I get is indeed 3.x. I have no idea why.

Either way, the method with $().on("unload", handler) works with both versions.

For completeness, I'm on Chrome, on Ubuntu.