Computing the edit context root -- need verification

Could someone from Adobe verify that this code properly computes the edit context root, given a selection?

It’s very simple and to the point, I hope. It works by running through the selection, and finding the lowest-common-ancester at each point, with the special case of an artboard result being promoted to root.

I’m using this in my Layers for Developers plugin–plug: it’s an invaluable, free tool for all devs, and I’d love you to try it out–to show the current edit context root, and I don’t want to mislead people. Thus my request for verification.

Question : why promote to the root level when the common root is an artboard?

Because that’s what the documentation says.

Doesn’t make sense to me, either. :wink: