Looks good to me. We had the same issue and the proposed changes fixed the bug for us.
We don't have webform installed but the error occurs on any form after firering too many click events, i. e. editing a lot of textfields or check/uncheck checkboxes several times.
Here's how to reproduce the error:
- Upgrading tb_megamenu to alpha4
- Open a form. On Firefox it is enough to check and uncheck a checkbox several times until the tab gets slower and then completely freezes. On Chrome I needed to edit a lot of textfields until the tab also freezed.
- CPU usage of tb_megamenu/dist/js/frontend.js skyrocketed
I found out that this commit https://git.drupalcode.org/project/tb_megamenu/-/commit/a90a1c892369945a... is causing the issue. After commentig the following code in plugin.js out and running yarn build, everything works again:
// Anytime there's a click outside a desktop menu that has arrows, close the menu.
document.addEventListener('click', event => {
if (!event.target.closest('.tbm') && !this.isMobile && this.hasArrows) {
this.closeMenu();
}
});
Since this issue is still relevant in 2.0, I wrote a patch that removes the internal:/ schema when extracting links, i.e. directly in the LinkLinkExtractor Plugin. That way the linkchecker module treats it like any other relative link.