pcooksey/bibtex-js

Auto-importing jquery creates potential race condition with external jquery import

Opened this issue · 0 comments

I ran into many odd, spurious errors when using it with a bootstrap template. Many hours of debugging later I realized this was because bootstrap uses jquery, I was using a different version, and both of these were imported before bibtex.js. Sometimes one load would complete first, other times it would complete second. The polling in checkReady cannot guarantee which one is used, and perhaps some hooks from each are used. This caused many unreproducible bugs involving tooltips, ajax, and tabs. Ensuring that the external call came first - and using the non-slim version that includes ajax - made most of these problems go away.

I appreciate the elegance of a self-contained script, but I think it hides important information from other developers!

(Also, perhaps it should be a separate issue, but I also noticed the imports of jquery and moment are missing subresource integrity attributes, which are important to avoid CDN server-side attacks. See srihash.org for more info.)