text-overflow is defined in CSS UI (should be moved into CSS Overflow per resolution) as:
- Applies to: block containers
- Inherited: no
Since the property controls how inline contents overflow line boxes, I would assume that the value that matters is the one of the block container that establishes the inline formatting context to which the line boxes belong.
The problem is that properties that apply to IFC roots should be inheritable, because lots of IFC roots are anonymous blocks. But this is a special case, because text-overflow has effect only if overflow is not visible, and overflow is definitely not inherited. Therefore it cannot just be said that anonymous blocks must act as if they were assigned text-overflow: inherit via a rule in the UA origin (because overflow should definitely not be inherited)
So consider this example: https://jsfiddle.net/fck9xqtx/
<div id="test1">abcdefghijklmoqrstuvwxyz</div>
<div id="test2">
<div>-</div>
<div>abcdefghijklmoqrstuvwxyz</div>
</div>
#test1, #test2 {
text-overflow: ellipsis;
overflow: hidden;
width: 50px;
}
#test1::before {
content: "-";
display: block;
}
In #test1 there is a ::before block, and then the other text is wrapped inside an anonymous block which is what establishes the IFC (and not #test1).
In #test2 it's basically the same, but now the inner block is element-generated.
Both Firefox and Chrome show ellipsis in #test1 and do not in #test2. Edge does not show ellipsis in either case.
Given the current definitions, I think Edge's behavior makes more sense, but it's not useful because anonymous blocks can't be selected to assign text-overflow and overflow styles. Additionally I think IFC should always be established by anonymous blocks, but with Edge's behavior this would mean that text-overflow would never work.
So I think the spec should say something like that anonymous blocks are ignored even if the IFC is established by them, and that the values of text-overflow and overflow that matter are the ones of the nearest non-anonymous block ancestor.
text-overflowis defined in CSS UI (should be moved into CSS Overflow per resolution) as:Since the property controls how inline contents overflow line boxes, I would assume that the value that matters is the one of the block container that establishes the inline formatting context to which the line boxes belong.
The problem is that properties that apply to IFC roots should be inheritable, because lots of IFC roots are anonymous blocks. But this is a special case, because
text-overflowhas effect only ifoverflowis notvisible, andoverflowis definitely not inherited. Therefore it cannot just be said that anonymous blocks must act as if they were assignedtext-overflow: inheritvia a rule in the UA origin (becauseoverflowshould definitely not be inherited)So consider this example: https://jsfiddle.net/fck9xqtx/
In
#test1there is a::beforeblock, and then the other text is wrapped inside an anonymous block which is what establishes the IFC (and not#test1).In
#test2it's basically the same, but now the inner block is element-generated.Both Firefox and Chrome show ellipsis in
#test1and do not in#test2. Edge does not show ellipsis in either case.Given the current definitions, I think Edge's behavior makes more sense, but it's not useful because anonymous blocks can't be selected to assign
text-overflowandoverflowstyles. Additionally I think IFC should always be established by anonymous blocks, but with Edge's behavior this would mean thattext-overflowwould never work.So I think the spec should say something like that anonymous blocks are ignored even if the IFC is established by them, and that the values of
text-overflowandoverflowthat matter are the ones of the nearest non-anonymous block ancestor.