This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13996 - Don't wrap invisible nodes when doing inline styling
Summary: Don't wrap invisible nodes when doing inline styling
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - HTML Editing APIs (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Aryeh Gregor
QA Contact: HTML Editing APIs spec bugbot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14231
  Show dependency treegraph
 
Reported: 2011-09-01 14:58 UTC by Aryeh Gregor
Modified: 2011-09-21 17:49 UTC (History)
3 users (show)

See Also:


Attachments

Description Aryeh Gregor 2011-09-01 14:58:06 UTC
Reported by Tim Down by private e-mail.

E.g., if we bold

  <p>foo</p> <p>bar</p>

currently we produce

  <p><b>foo</b></p><b> </b><p><b>bar</b></p>

The extra <b> in the middle is pointless.  The user can never focus the collapsed whitespace node, after all.  We should abort early in "force the value" if the node is invisible, just like if the value already matches.
Comment 1 Tim Down 2011-09-01 16:05:51 UTC
The extra <b> element is not only pointless but can also change the layout. In the

  <p><b>foo</b></p><b> </b><p><b>bar</b></p>

example, if there is a style rule that adds a border to <b> elements, the middle <b> adds an extra unwanted line box in CSS 2.1 compliant browsers such as Firefox.
Comment 2 Aryeh Gregor 2011-09-01 17:07:32 UTC
If tags like <b> have any style effects other than the default, all sorts of stuff will get messed up.  All the spec algorithms assume that <b> does nothing except make stuff bold.  So I explicitly don't care about things like authors adding a border to <b> -- they're shooting themselves in the foot and I can't stop it, so I won't try.
Comment 3 Aryeh Gregor 2011-09-19 22:20:54 UTC
I've got a patch to do this now, but it has an undesired side effect I forgot about: after running a command like bold, the command might be indeterminate.  I need to ignore invisible nodes when computing indeterm/state/value for this change to make sense.
Comment 4 Aryeh Gregor 2011-09-21 17:42:12 UTC
https://dvcs.w3.org/hg/editing/rev/b2d328d179ac

Bug 14231 filed as followup on an issue that arose while fixing this.
Comment 5 Aryeh Gregor 2011-09-21 17:49:14 UTC
I checked in some extra tests afterward too:

https://dvcs.w3.org/hg/editing/rev/4321a7e11603