Open Bug 417826 Opened 16 years ago Updated 2 years ago

In table cell, width="0px" is ignored, but style="width: 0px" is honored

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox67 --- affected
firefox68 --- affected
firefox69 --- affected
firefox70 --- affected
firefox71 --- affected

People

(Reporter: dholbert, Unassigned)

References

Details

Attachments

(2 files)

In Trunk on a table cell, we honor
  style="width: 0px"
as a specified-width of 0px, but we ignore
  width="0"
and treat it as auto-width.

This was noted in https://bugzilla.mozilla.org/show_bug.cgi?id=413286#c19.  The auto-width behavior is due to nsHTMLTableCellElement.cpp:338, with the explanatory comment "0 implies auto for compatibility."

We should make the behaviors of styled zero-width and attribute zero-width consistent -- either ignore both, or honor both.
The top half of testcase 1 shows the bug in Firefox Trunk -- the zero-width "as attribute" version matches "No Width", but the zero-width "as style" version doesn't match -- it honors the zero-width, and consequently shrink-wraps to the min-width of the light blue cell.

In other browsers, all of the "Width is 0" cases are indistinguishable* from the "No Width" cases.  (Other browsers  = WebKit/Konqueror, Opera, IE7, and FF2.)

So, in the interest of compatibility, I think we should probably shift to make styled zero-width behavior match attribute zero-width behavior -- that is, we should ignore a styled zero-width, and treat it instead as auto-width.

*indistinguishable -- but with one funny exception: IE7 seems to ignore 'width="0%"', but honors 'style="width: 0%"'.  It's similar to this bug here, but with % instead of px.
So... if I recall how this works, the idea is that per CSS spec "width:0" is pretty well-defined and we do what it says to do.  The width="0" behavior is there for compat with IE.  I'm guessing the other UAs made width="0" behave that way for compat reasons and did the style thing for the same reasons you're proposing here... but is this particular spec violation really something we want?  If so, can we at least get the spec changed?
So I think we should stick to honoring the CSS -- it's potentially a useful feature, and it produces more sensible/understandable behavior for authors when we honor it.  The question is whether we should start honoring HTML width="0".

I don't know of any specs that define any of this; which ones are you referring to?
Webcompat Priority: ? → revisit
Webcompat Priority: revisit → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: