-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(observers): allow for mutation observer options to be customized in content observer #13842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2832d6f
to
a70216f
Compare
I worry this makes the What do you think about making a separate |
The default consumption is as simple as before, the only difference is that people who know what they're doing can pass in some extra options. My concern is that if added another API, we'd have pretty much the same logic, but with the ability to pass in a settings object. |
Coming back to this PR- was this requested somewhere? My main thought now is wanting to avoid the extra code if nobody has really asked for it. |
It wasn't requested anywhere, but it's something I noticed when fixing issues that involved |
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
2 similar comments
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
a70216f
to
97be7e0
Compare
97be7e0
to
d9f5205
Compare
Hi there, my understanding is that we would be able to observe if a specifig img tag for example would be loaded. If that's the case, I do feel like we developers have a true need of this, as I can read quite a lot of things about lazy loading images. And this is just 1 use case. |
Any update on this, please? I would also like this since the content observer is unable to detect img src changes with the current configuration. Thank you. |
… in content observer Currently we always use the same set of `MutationObserver` options to monitor an element, however if the consumer knows what they want to monitor, they could gain a performance benefit from configuring the observer differently. These changes rework the `ContentObserver` to allow it to handle multiple observers per element that are cached based on their options.
d9f5205
to
7a90374
Compare
@jelbourn should we revisit this now that we've had a few requests for it? |
@crisbeto let's discuss in the next team meeting. I'm still of the opinion that, if we want to broaden the scope of this directive, at the very least the name needs to change. |
We talked about this at our team meeting. Resolution:
|
Any chance we can get this in v10? I'd really like to use it to swap out images based upon some attributes. |
I was hoping to use this to observe an HTML attribute, but alas, I guess I'll be using native MutationObserver instead... 😞 |
Currently we always use the same set of
MutationObserver
options to monitor an element, however if the consumer knows what they want to monitor, they could gain a performance benefit from configuring the observer differently. These changes rework theContentObserver
to allow it to handle multiple observers per element that are cached based on their options.