In my opinion, WebView should take responsibility for removing itself or any subordinate objects from WebView undoManager: in this case, yours.
Judging by your description, this does not do this. I suspect that your goal of finding a target so that you can explicitly remove it will be useless, so I would like to suggest another solution that I used before, or I have come far enough along this path to think about using; )
The idea of ββthis situation was to use a custom subclass of NSUndoManager, which is able to store its own excess memory of all registrations on it (by overriding registerUndoWithTarget: ... and prepareWithInvocationTarget). With a reliable array of all registrations, you can impose your own house cleaning policy at any time. That is, you can say: βIf the target class belongs to a structure that I donβt own, just delete itβ ... or specify and say that you want to delete everything that corresponds to the WebEditorUndoTarget class, for example.
source share