I read here that \"self Refers to the current window or form\".
Self does not seem to refer to the current form in this case:
self refers to the global scope - If the context is a window it will refer to window.self, while in case of a non-windowed context it will refer to the global scope of that context (e.g. in service worker code, self refers to the worker global scope).
self refers to the global scope of a context:
https://developer.mozilla.org/en-US/docs/Web/API/Window/self