theCrius / tildes-extended

Extension for Chrome and Firefox to enhance the UX/UI of https://tildes.net
ISC License
14 stars 5 forks source link

Fix #8 using MutationObserver #13

Closed odensc closed 6 years ago

theCrius commented 6 years ago

Hey, thanks for that, it works (although I need to find some time to read it properly and understand why mine wasn't) except an error when you're in a page that is not a topic page.

I'll merge it and add a check so that it run only when in a topic's page that is where we've the issue anyway :)

odensc commented 6 years ago

The gist of it is that you were listening on document.body, but the comment elements are too deep in the DOM to be picked up by that. If you enabled subtree: true it would have worked, but it would be pretty inefficient - so I listened on the parent element of the comments.

theCrius commented 6 years ago

got it, i thought that child (or however that setting was, maybe childrens) was enough to have it iterate through the whole thing.

However yeah, it would have been definitely not optimised, thanks again!