[Bug 14231] New: Force values of runs of consecutive nodes, not individual nodes


           Summary: Force values of runs of consecutive nodes, not
                    individual nodes
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML Editing APIs
        AssignedTo: ayg@aryeh.name
        ReportedBy: ayg@aryeh.name
         QAContact: sideshowbarker+html-editing-api@gmail.com
                CC: mike@w3.org, public-webapps@w3.org

Consider the following test case for bold:

  <p>[foo</p><p> <span>bar</span> </p><p>baz]</p>

We wrap each of the inline nodes one by one:

1) <p>[foo</p><p> <span>bar</span> </p><p>baz]</p>
2) <p>[<b>foo</b></p><p> <span>bar</span> </p><p>baz]</p>
3) <p>[<b>foo</b></p><p> <b><span>bar</span></b> </p><p>baz]</p>
4) <p>[<b>foo</b></p><p> <b><span>bar</span> </b></p><p>baz]</p>
5) <p>[<b>foo</b></p><p> <b><span>bar</span> </b></p><p><b>baz</b>]</p>

Notice how when going from 2->3, we skip the space before <span>bar</span>. 
That's because it's an invisible node, so we don't want to create a <b> to wrap
it in (bug 13996).  This is to avoid wrapping standalone spaces like in
  <p>[foo</p> <p>bar]</p>
But the second space we do wrap, because we'll add invisible nodes to existing
adjacent wrappers just fine.  This is needed for cases like
  <span>[foo</span> <span>bar]</span>
where we want
  <b><span>[foo</span> <span>bar]</span></b>
rather than
  <b><span>[foo</span></b> <b><span>bar]</span></b>

The only way I see to fix this is to rewrite "setting the selection's value" to
look at whole runs of adjacent nodes before deciding which ones to force.  Then
we can force a whole run if it contains any visible editable node, whether
there are invisible nodes before or after.

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Wednesday, 21 September 2011 17:41:37 UTC