|
@@ -149,8 +149,8 @@ This is useful for userscripts that need to wait for elements to be added to the
|
|
|
|
|
|
The constructor takes a `baseElement`, which is a parent of the elements you want to observe.
|
|
|
If a selector string is passed instead, it will be used to find the element.
|
|
|
-If you want to observe the entire document, you can pass `document.body`
|
|
|
-
|
|
|
+If you want to observe the entire document, you can pass `document.body` - ⚠️ you should only use this to initialize other SelectorObserver instances, and never run continuous listeners on this instance, as the performance impact can be massive!
|
|
|
+
|
|
|
The `options` parameter is optional and will be passed to the MutationObserver that is used internally.
|
|
|
The MutationObserver options present by default are `{ childList: true, subtree: true }` - you may see the [MutationObserver.observe() documentation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe#options) for more information and a list of options.
|
|
|
For example, if you want to trigger the listeners when certain attributes change, pass `{ attributeFilter: ["class", "data-my-attribute"] }`
|