enclosingLayer() walks the entire parent chain, making it slow for deep trees It makes repaint/layout samples account for about 30% of: http://www.robohornet.org/tests/descendantselector.html (which I'm not suggesting is either a good or bad benchmark, merely one which triggers this condition.)
I assume you mean "slow for deep, layer-sparse trees"?
Yes, deep, layer-sparse. :)