I wanted to observe "isConnected" property of an HTMLElement. But since it's a read-only property no propertyDiscriptor exists on it. So the classic approach of overriding getter and setter or creating a proxy object won't be useful.
I have read on mutationObserver, that they can only observe attributes. They are also heavy for our application as we need to observe this propperty(isConnected) on every dynamic element that we create ( 80% of the application is just dynamic elements).
Is there any other way to observe changes to readonly properties?
The OP should give
MutationObserver
a try. For the OP's case a node'sisConnected
attribute can not be directly observed but the same information ... node either is or is not part of the rendered DOM ... can be retrieved from a'childList'
mutation type ...