The current toc.js does not take the context into account. Example file attached, let me know if you would like a patch. The attached example checks that the context is the document object, but that might not be the best approach.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | toc-avoid_dupe_js-2482815-5.patch | 1.12 KB | rooby |
Comments
Comment #1
rv0 commentedWhat issues does it cause?
Comment #2
tedfordgif commentedThe Quick Edit module causes a second call to the attach behavior, and the context argument is set to the popup div. Without the change above, a second table of contents is created just below the first one.
Comment #3
rv0 commentedThere is no patch.
Comment #4
rooby commentedContext will help with performance because you aren't processing the whole document each time, but it should also use jquery.once to avoid scenarios where it tries to apply the toc multiple times to the same element.
Comment #5
rooby commentedTry this patch
Comment #7
rv0 commentedsolid remarks and looks good to me.
thanks