That's all right, it's hidden:
Element div not allowed as child of element span in this context. (Suppressing further errors from this subtree.)
Span is inline element. In HTML5 parser
markup is not broke than you set block element
into inline element
. But computation engine
is not HTML5 parser
. It works right for right markup.
What is computation engine
? Open timeline
in devtool bar of any big site and get the computation layers
message on any ajax action, for example. That is it, this engine calculate/recalculate DOM
offsets and sizes.
Edit:
getBoundingClientRect()
return none zero sizes. But it works like this:
- Clone the node to abstract sandbox
- Calculate all styles which needs to apply the node
- Apply then
- Calculate the sizes
So getBoundingClientRect
make many unnecessary operations.