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 15238 - "To split a Text node" steps logical error
Summary: "To split a Text node" steps logical error
Status: RESOLVED WORKSFORME
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-16 23:41 UTC by Brandon Slade
Modified: 2011-12-17 10:59 UTC (History)
2 users (show)

See Also:


Attachments

Description Brandon Slade 2011-12-16 23:41:43 UTC
In the steps given in the "To split a Text node [...] run these steps" section (see http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-text-split) there are a few logical errors that I'd like to point out.

For step 8, substeps 1 and 2:

"1. For each range whose start node is node, start offset is greater than or equal to offset, and end offset is greater than offset, set both its start node and end node to new node and decrease its start offset and end offset by offset.

2. For each range whose end node is node and end offset is greater than offset, set its end offset is offset."

and for steps 9 and 10:

"9. For each range whose start node is node and start offset is greater than offset, set its start node to new node and decrease its start offset by offset.

10. For each range whose end node is node and end offset is greater than offset, set its end node to new node and decrease its end offset by offset."

As a reminder, each range's boundary point's offset must be a value from 0 (inclusive) to the node length (exclusive). So, these steps should be changed to read ...

"1. For each range whose start node is node, start offset is greater than or equal to offset, and end offset is greater than OR EQUAL TO offset, set both its start node and end node to new node and decrease its start offset and end offset by offset.

2. For each range whose end node is node and end offset is greater than OR EQUAL TO offset, set its end offset is offset."

... and ...

"9. For each range whose start node is node and start offset is greater than OR EQUAL TO offset, set its start node to new node and decrease its start offset by offset.

10. For each range whose end node is node and end offset is greater than OR EQUAL TO offset, set its end node to new node and decrease its end offset by offset."

These modifications prevent a range boundary's offset from being set to the node's length.
Comment 1 Anne 2011-12-17 10:59:41 UTC
I fixed the typo, but the essence here is correct. Unless end offset is actually greater, nothing needs to be done. Note that start offset cannot be greater while end offset is not.

https://bitbucket.org/ms2ger/dom-core/changeset/be8a6d334ecf

Thanks for your feedback!