Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c51a6e0

Browse files
committed
Add explanatory note for bare traceback handling
1 parent 4705fb0 commit c51a6e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python_docs_theme/static/copybutton.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
const loadCopyButton = () => {
3-
/* Add a [>>>] button on the top-right corner of code samples to hide
3+
/* Add a [>>>] button in the top-right corner of code samples to hide
44
* the >>> and ... prompts and the output and thus make the code
55
* copyable. */
66
const hide_text = 'Hide the prompts and output'
@@ -19,6 +19,8 @@ const loadCopyButton = () => {
1919
if (buttonEl.dataset.hidden === 'false') {
2020
// hide the code output
2121
codeEl.querySelectorAll('.go, .gp, .gt').forEach(el => el.hidden = true)
22+
// tracebacks (.gt) contain bare text elements that need to be
23+
// wrapped in a span to hide or show the element
2224
codeEl.querySelectorAll('.gt').forEach(el => {
2325
while ((el = el.nextSibling) && el.nodeType !== Node.DOCUMENT_NODE) {
2426
if (el.nodeType === Node.ELEMENT_NODE && el.matches(".gp, .go")) {

0 commit comments

Comments
 (0)