Reduce use of wrapper nodes#993
Conversation
If element doesn't contain have any non-whitespace text node children, use the child element nodes as the wrapper nodes.
There was a problem hiding this comment.
It might be helpful to merge this comment with the function-level comment.
It might be helpful to include the "why" (from the PR description) in the comment.
Out of curiosity, does this make rendering slightly "worse" for something like this?
<ix:nonNumeric>
<div>First line</div>
<div>middle of sentence</div>
<div>end of sentence.</div
</ix:nonNumeric>
I wonder if a heurstic could be: ignoring whitespace-only text nodes, if there's exactly one child node remaining and it's an element, use it directly.
There was a problem hiding this comment.
Out of curiosity, does this make rendering slightly "worse" for something like this?
Arguably yes. New behaviour:
vs current behaviour:
Although possibly the new behaviour is more honest if the children are of varying widths:
I was taking the view that if we can reasonably avoid inserting nodes we should do so, as it reduces the risk of breaking the document. You might conceivably have multiple inline-block children, in which case we'd still want to avoid adding a wrapper.
I'm not sure how common this is anyway. I think where an ix node wraps multiple elements, they'd typically be absolutely positioned anyway.
Comments improved in f2c7742.
Co-authored-by: Austin Matherne <austin.matherne@workiva.com>
If element doesn't contain have any non-whitespace text node children, use the child element nodes as the wrapper nodes.
Reason for change
Faced with a document like this using inline block elements to create a column layout:
The viewer was inserting a
display: blockwrapper node. This interfered with layout of the columns. Aninline-blockwrapper wouldn't fix this, as it defaults to "100%" width.Description of change
The viewer now doesn't insert a wrapper node at all in this case; instead, it uses the child node(s) as the
ixbrl-elementnodes.Steps to Test
Test with sample document on XT-5354.
review:
@Arelle/arelle
@paulwarren-wk