Skip to content

Commit

Permalink
Fix JavaScript error on pages with a TOC
Browse files Browse the repository at this point in the history
When loading a documentation page with a table of contents (e.g.
https://www.raspberrypi.com/documentation/computers/getting-started.html),
the following JavaScript error is thrown in the console:

    TypeError: e.indexOf is not a function. (In 'e.indexOf(" ")',
    'e.indexOf' is undefined)

This is caused by a unsupported mix of dependencies for Tocify:
specifically, we're attempting to load jQuery 3.6.0 which removed an API
used by Tocify (see
gfranko/jquery.tocify.js#103).

Fix this by loading versions of jQuery and jQuery UI that are supported
by Tocify.
  • Loading branch information
mudge committed Dec 15, 2021
1 parent 38e09d8 commit fe6221a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions jekyll-assets/_includes/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<script src="{{ site.baseurl }}/scripts/nav.js" type="text/javascript"></script>

<!-- TOCify scripts -->
<script src="{{ site.baseurl }}/scripts/jquery-3.6.0.min.js"></script>
<script src="{{ site.baseurl }}/scripts/jquery-ui-1.9.1.custom.min.js"></script>
<script src="{{ site.baseurl }}/scripts/jquery-1.12.4.min.js"></script>
<script src="{{ site.baseurl }}/scripts/jquery-ui-1.13.0.custom.min.js"></script>
<script src="{{ site.baseurl }}/scripts/jquery.tocify.min.js"></script>

<!-- Copy To Clipboard scripts -->
Expand Down
5 changes: 5 additions & 0 deletions jekyll-assets/scripts/jquery-1.12.4.min.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions jekyll-assets/scripts/jquery-3.6.0.min.js

This file was deleted.

6 changes: 6 additions & 0 deletions jekyll-assets/scripts/jquery-ui-1.13.0.custom.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions jekyll-assets/scripts/jquery-ui-1.9.1.custom.min.js

This file was deleted.

0 comments on commit fe6221a

Please sign in to comment.