Skip to content

Reduce use of wrapper nodes#993

Merged
austinmatherne-wk merged 3 commits intoArelle:masterfrom
paulwarren-wk:reduce-wrapper-nodes
Feb 9, 2026
Merged

Reduce use of wrapper nodes#993
austinmatherne-wk merged 3 commits intoArelle:masterfrom
paulwarren-wk:reduce-wrapper-nodes

Conversation

@paulwarren-wk
Copy link
Contributor

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:

<div style="display: inline-block; width: 40%>
column 1
</div>
<ix:nonNumeric>
  <div style="display: inline-block; width: 45%">
column 2
  </div>
</ix:nonNumeric>

The viewer was inserting a display: block wrapper node. This interfered with layout of the columns. An inline-block wrapper 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-element nodes.

Steps to Test

Test with sample document on XT-5354.

review:
@Arelle/arelle
@paulwarren-wk

If element doesn't contain have any non-whitespace text node children,
use the child element nodes as the wrapper nodes.
@paulwarren-wk paulwarren-wk requested a review from a team as a code owner February 8, 2026 22:57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@paulwarren-wk paulwarren-wk Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, does this make rendering slightly "worse" for something like this?

Arguably yes. New behaviour:

image

vs current behaviour:

image

Although possibly the new behaviour is more honest if the children are of varying widths:

image

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.

Paul Warren and others added 2 commits February 9, 2026 22:05
Co-authored-by: Austin Matherne <austin.matherne@workiva.com>
@austinmatherne-wk austinmatherne-wk merged commit 0304846 into Arelle:master Feb 9, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments