uzairfarooq / arrive

Watch for DOM elements creation and removal
MIT License
869 stars 99 forks source link

Detect page title change #84

Open TuTAH1 opened 2 years ago

TuTAH1 commented 2 years ago

I throught that this code will execute every time when page is changing. I was fear it can trigger itself, because it executes a function that changes itself, but it didn't work at all (for example, if I just call removeCapsFromElement(document.querySelector("title")) I can see it's changing for a split second, but when I replace it by

document.arrive( "title", {fireOnAttributesModification: true}, pageName => removeCapsFromElement(pageName))

, it doesn't work at all. Where is my mistake?

uzairfarooq commented 2 years ago

That’s not how it works. You need to specify selector for the element which is changing.

TuTAH1 commented 2 years ago

That’s not how it works. You need to specify selector for the element which is changing.

What do you mean? title is changing and I specified a selector for it

uzairfarooq commented 2 years ago

I see, the current version of arrive does not support support content change. So if the text of element changes, it wont trigger arrive callback.

I think i have a little modified version of arrive which does trigger callback on content change but it depends on a jQuery selector. I can share it tomorrow if you need it.

TuTAH1 commented 2 years ago

I can share it tomorrow if you need it.

Yeah, it would be great, thanks

ZzZombo commented 1 year ago

@uzairfarooq: any update? This restrict me from adopting your library currently as text changes are needed.