Closed Bug 50574 Opened 25 years ago Closed 25 years ago

Formatting tags in tables stop working after division tags

Categories

(Core :: Layout, defect, P3)

x86
Windows NT
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: john, Assigned: clayton)

References

()

Details

(Keywords: verifyme)

Sorry, I don't know what you call them, but I will define terminology: Formatting tags: B, U, I, FONT (anything which changes the look of text but does not divide it) Division tags: DIV, TABLE, H1 (anything which divides the text layout-wise, even if it is also a formatting tag) As you can see in the testcase, the text that says it should not be bold, is bold. So the story goes like this: I found a weird phenomenon testing one of my documents and reduced it to a testcase. Specifically, what seems to be happening is three conditions together that make text appear with the wrong formatting (if you remove any of them things work fine): 1. The text must be inside a table cell. 2. A formatting tag must precede the text. 3. There must be a division tag inside the formatting tag. Basically, the structure must look like this: <TABLE><TR><TD> <formatting tag> <division tag></division tag> </formatting tag> Text that formatting tag should not apply to but does anyway. </TD></TR></TABLE> I have tried several combinations now: FONT and B for the formatting tag, and DIV and H1 for the division tag, and it comes out the same. SPAN for the division tag does not come out that way, so I guess it doesn't count as a division tag. Strange thing: A TABLE inside the formatting tag acts like a division tag, but with the added effect that the text inside the TABLE tag is not formatted with the outer formatting tag (which I would expect as a programmer). I do not know if this is a bug (maybe some weird bit of the spec), but someone might wish to look into it. It seems like this must be the formatting portion of the renderer; I think I ruled out the parser. I gave the B an ID and printed innerHTML from JavaScript ... it didn't include the words "This Should Not Be Bold".
What you call a 'formatting tag' is called an 'inline element'. What you call a 'division tag' is called a 'block element'. The only problem is that there is a general rule that inline elements may not contain block elements. So Mozilla has to do all kinds of acrobatics when it comes across this case -- for example, <B> <H1> </H1> </B> -- to try to make it work. The W3C suggest the use of stylesheets for formatting instead of formatting tags. See http://www.w3.org/TR/REC-CSS1 for more details.
Status: UNCONFIRMED → RESOLVED
Closed: 25 years ago
Keywords: verifyme
Resolution: --- → WONTFIX
Could you give me a head start on where to look in the code if I wanted to try and fix this myself? It's rather counterintuitive behavior, even if the spec does say that. Even a general module would be useful.
Sure. I believe the code to change is in .../mozilla/htmlparser/src/nsElementTable.cpp You may wish to see bug 47827 where a similar bug (but this time where we got the standards wrong) was recently fixed. Note, though, that unless you have a very strong reason to fix this (e.g., a top100 site breaks on it) then there are many more somewhat more important bugs that you could help fix...
You need to log in before you can comment on or make changes to this bug.