DEV: improve header dock class implementation (PR #13840)

WIP

GitHub

this._stickyHeaderDockObserver?.unobserve(this._dockAnchor);

If we only use this _dockAnchor for cleanDom, I’m not sure there’s big value in keeping it around, maybe we just requery dom when cleaning it

where is this used now ?

in any case it should have be _dockedHeader, doesn’t seem like it’s used in public API

maybe we just assign it directly here: this._stickyHeaderObserver = …

Didn’t try it live, but approach sounds good to me.

It’s not used anymore, so I’ll just remove it for now. I checked all-the-themes, all-the-plugins, all-custom-themes, and all-custom-plugins repos and it’s not used there either.

Im curious what happens when we pass undefined to unobserve ?

That won’t happen because this._stickyHeaderDockObserver is null unless we have dockAnchor

Yes that was more a general question I had about this, but I will try myself :stuck_out_tongue:

how could element be null here ?