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.

CommentFileSizeAuthor
#5 toc-avoid_dupe_js-2482815-5.patch1.12 KBrooby
toc.js.txt655 bytestedfordgif

Comments

rv0’s picture

Status: Active » Postponed (maintainer needs more info)

What issues does it cause?

tedfordgif’s picture

Status: Postponed (maintainer needs more info) » Needs review

The 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.

rv0’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs review » Needs work

There is no patch.

rooby’s picture

Context 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.

rooby’s picture

Status: Needs work » Needs review
StatusFileSize
new1.12 KB

Try this patch

  • rv0 committed 91a55b7 on 7.x-1.x authored by rooby
    Issue #2482815 by rooby: toc.js should allow calling the attach behavior...
rv0’s picture

Status: Needs review » Fixed

solid remarks and looks good to me.
thanks

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.