Closed Bug 204401 (del-only-inline) Opened 21 years ago Closed 13 years ago

<del> doesn't strike all contents (text-decoration stops at inlines)

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: fred, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3) Gecko/20030312

<del> and <ins> may be used as either inline or block level elements. These are
special-cased in the W3C validator, and should be in Gecko as well. Mozilla
incorrectly terminates such elements as soon as it encounters a block-level
element inside the content of <del>. DOM inspector has the same behavior.

Reproducible: Always

Steps to Reproduce:
1. View a page with <del> used as a block-level element that contains other
block-level elements.
Actual Results:  
Strike-through style is not rendered.

Expected Results:  
Decorate all text that is within a <del> element with strike-through.
Attached file testcase
I didn't look at the URL provided very closely, but this testcase seems to show
the problem you describe.

This seems to be a problem in the strict-mode text-decoration code.
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: MacOS X → All
Hardware: Macintosh → All
The test code does demonstrate the problem. Note that the DOM Inspector's tree
view correctly shows the content of del as indented within it, but using the
click-search tool on the del label demonstrates that Mozilla treats the del
element as terminating at the first block element in the content of del.

I do not know the gecko internals, but this behavior suggests a problem in
parsing the HTML, not in decorating it.
That would be because <del> is an inline box and we only walk up until we hit an
inline when trying to work out what text-decoration to apply.

The obvious fix is a no-go due to performance concerns, I imagine. (Using the
selector "del *".) The other possibility, namely making del be block-level under
certain elements, is probably a non-starter since some elements (e.g. div) can
contain mixtures.

Maybe we should revisit our logic to walk up the tree for text-decoration. We
can go either way at the moment, CSS2.1 and CSS3 disagree with each other.
Severity: major → normal
Summary: <del> tags used as block-level elements terminate early → <del> doesn't strike all contents (text-decoration stops at inlines)
*** Bug 219194 has been marked as a duplicate of this bug. ***
*** Bug 219770 has been marked as a duplicate of this bug. ***
Per CSS2.1, text-decoration "is not, however, further propagated to floating and
absolutely positioned descendants, nor to the contents of 'inline-table' and
'inline-block' descendants. Nor is it propagated to block-level descendants of
inline elements."

INVALID?
No, that would just imply that 'text-decoration' isn't appropriate for DEL and
we need a new property.
http://www.w3.org/TR/html401/struct/text.html#h-9.4
Says that line-through; is acceptable, but since it is not acceptable in CSS2.1
(and 3?) I suggest display:none;, which is the recommandation for the current
XHTML2.0 (although there it is edit="deleted") and is also an option in HTML4.01:

"User agents should render inserted and deleted text in ways that make the
change obvious. For instance, inserted text may appear in a special font,
deleted text __may not be shown at all__ or be shown as struck-through or with
special markings, etc."
We could still use text-decoration (see comment 3). Maybe we just need a special
keyword on text-decoration that means "go into blocks".
Actually the universal selector idea wouldn't work anyway because you'd end up
with a gazillion lines everywhere.

Note that 'background' suffers from the same problem as t-d here: when the
element is inline, the background doesn't affect block children.

I think the worst case we have to deal with is:

   <block>
    <inline>
     Not deleted.
     <del>
      Deleted.
      <inline>
       Deleted.
       <block>
        <inline>
         Deleted.
        </inline>
       </block>
       Deleted.
      </inline>
      Deleted.
     </del>
     Not deleted.
    </inline>
   </block>

...where we really want a red background and line-through to render through and
behind anything marked "Deleted". I don't see a way to do this with pure CSS.
text-decoration is not the only thing that doesn't work, see the attachment.

Any suggestions? Perhaps bug 219770 should be reopened with a slighly different
title.
Ian's "worst case" seems a bit of a red herring. It's invalid in that del cannot surround such a mix of 
inline and block. The error in Gecko appears to be uniformly treating del/ins as inline. This is 
contrary to the standard, and other rendering engines get it right (see, for example, Apple's 
WebCore/KHTML). Gecko should render valid code correctly before we consider what to do about 
degenerate code.
comment 12 confuses HTML's %inline and %block productions and CSS's 'display'
property.  They are entirely separate.
<ins> and <del> at the block level were decorated up until version 1.3.

Adding as a blocker to #41368, since I recently updated my <ins>/<del> test to
include block level uses (http://www.robinlionheart.com/stds/html4/edit.html). 
Blocks: robin's
(In reply to comment #13)
> comment 12 confuses HTML's %inline and %block productions and CSS's 'display'
> property.  They are entirely separate.

Your comment is not cogent. It matters not whether the CSS display property is block or inline. What 
matters is that Gecko inappropriately ends the element where the standard, the W3C validator, and 
other rendering engines do not.
(In reply to comment #15)
> It matters not whether the CSS display property is block or inline.

It most certainly does matter.  Try adding style="display:inline" to the p
elements in attachment 122444 [details].

It's been known that this is a rendering issue and not a parsing issue since
comment 1, so please stop confusing the issue by making incorrect statements
that you should have tested before making.
*** Bug 255407 has been marked as a duplicate of this bug. ***
Alias: DelOnlyInline
Alias: DelOnlyInline → del-only-inline
Keywords: testcase
Assignee: layout → nobody
QA Contact: ian → layout
Landing bug 403524 makes us fully compliant with CSS 2.1 spec for text decorations, and so resolves this issue.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.