element-timing icon indicating copy to clipboard operation
element-timing copied to clipboard

Specify the mapping of containing block to element

Open hawkinsw opened this issue 6 years ago • 5 comments
trafficstars

With respect to the proposal to use "nearest containing block ancestor" as the way to aggregate text nodes:

The containing block is a rectangle, not an element, and the mapping between rectangles and elements is not trivial

  1. a single element can map to multiple containing blocks,
  2. a single containing block might not map to any specific element at all (e.g. this is what you get if a table-row cell contains several block-and-text children: you get an anonymous table-cell box which determines the containing block for those blocks-and-text, but that box does not correspond to any elements).

Can we specify the mapping from containing blocks to elements?

hawkinsw avatar Aug 01 '19 17:08 hawkinsw

Thanks for the feedback! Interesting, anonymous layout objects are definitely a problem here. Any suggestions on how we can fix this? For example, could we consider the nearest element ancestor?

npm1 avatar Aug 07 '19 18:08 npm1

Parent element (the parent of a textnode that's bound to the document tree is always an element) is easy enough to do. Would it produce the right behavior?

One thing to consider: how do textnodes fundamentally differ from inline elements (replaced or non-replaced), apart from not being elements?

bzbarsky avatar Aug 07 '19 18:08 bzbarsky

Parent elements does not work like we'd like it to, for example consider the following paragraph: <p>See the <a href...>link</a>.</p> We want link to be grouped with p, hence why we used containing block (to attempt to visually group text elements).

One thing to consider: how do textnodes fundamentally differ from inline elements (replaced or non-replaced), apart from not being elements?

Not sure I understand the message here.

npm1 avatar Aug 13 '19 22:08 npm1

Not sure I understand the message here.

I think that question was due to not really checking how the association of text to containing block is used. Looks like it's pretty text-specific....

bzbarsky avatar Aug 14 '19 02:08 bzbarsky