Changeset 1162


Ignore:
Timestamp:
02/11/09 21:41:38 (11 years ago)
Author:
douglas
Message:

Fix the moveCursor on edge code to handle the case when a text node is not the first sibling of its parent (like when there are inline nodes, or we have a broken DOM)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Ticket1226/paraHandlerBest.js

    r1161 r1162  
    14821482  var cursorOffset = selection.anchorOffset; 
    14831483 
    1484   while (this.cursorAtEnd(cursorParent, cursorOffset)) 
     1484  for (;this.cursorAtEnd(cursorParent, cursorOffset);) 
    14851485  { 
    14861486    if (TEXT_NODE == cursorParent.nodeType) 
    14871487    { 
    1488       // If we're at the end and stuck inside of a text node, we move not just 
    1489       // out of the text node, but out of the node containing the text node. 
    1490       // The second part will be performed by the standard node moving logic 
    1491       // below.  We'll just move out of the text node here. 
     1488      // If we're at the end and stuck inside of a text node, we move out of 
     1489      // the text node, which is a simpler case, than continue. 
    14921490      var parentOffset = this.indexInParent(cursorParent); 
    14931491      if (null === parentOffset) 
     
    14991497      cursorParent = cursorParent.parentNode; 
    15001498      cursorOffset = parentOffset + 1; 
     1499      continue; 
    15011500    } 
    15021501 
     
    15251524  } 
    15261525 
    1527   while (this.cursorAtBeginning(cursorParent, cursorOffset)) 
     1526  for (;this.cursorAtBeginning(cursorParent, cursorOffset);) 
    15281527  { 
    15291528    if (TEXT_NODE == cursorParent.nodeType) 
    15301529    { 
    1531       // If we're at the beginning and stuck inside of a text node, we move not 
    1532       // just out of the text node, but out of the node containing the text 
    1533       // node.  The second part will be performed by the standard node moving 
    1534       // logic below.  We'll just move out of the text node here. 
     1530      // If we're at the beginning and stuck inside of a text node, we move out 
     1531      // of the text node, which is a simpler case, than continue. 
    15351532      var parentOffset = this.indexInParent(cursorParent); 
    15361533      if (null === parentOffset) 
     
    15421539      cursorParent = cursorParent.parentNode; 
    15431540      cursorOffset = parentOffset; 
     1541      continue; 
    15441542    } 
    15451543 
Note: See TracChangeset for help on using the changeset viewer.