yinso / ierange

Automatically exported from code.google.com/p/ierange
0 stars 0 forks source link

adoptBoundary is wrong when I select last child #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. http://ierange.googlecode.com/svn/trunk/sandbox.html
2. select 'Sandbox'
3. Log Range

What is the expected output? What do you see instead?
expected:
  "Start:" "Range Sandbox" 6"End:" "Range Sandbox" 13"Common Ancestor:"
"Range Sandbox"

insted:
  "Start:" "Range Sandbox" 6"End:" <h1> 1"Common Ancestor:" <h1>

What version of the product are you using? On what operating system?
ierange-m2 (also tried against r 32). Internet Explorer 8/Windows XP SP3.

Please provide any additional information below.
line 82
-  cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd',
textRange) > 0

+  cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd',
textRange) >= 0

Original issue reported on code.google.com by TakiTake...@gmail.com on 2 Jun 2009 at 9:15

GoogleCodeExporter commented 9 years ago
found the same problem in Internet Explorer 6 / Windows XP SP3

Original comment by leei...@gmail.com on 12 Jul 2009 at 1:03

GoogleCodeExporter commented 9 years ago
The fix for this requires some special handling of the case where the offset is 
beyond the end of the child nodes within the container.  My company (Pearl 
Crescent) has applied several fixes to convertFromDOMRange, including one for 
this issue.  I will attach the code we are using.

Original comment by markcsm...@gmail.com on 8 Mar 2011 at 4:40

Attachments:

GoogleCodeExporter commented 9 years ago
We had a contenteditable field with some <em>'s inside.

This fix
line 82
-  cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd',
textRange) > 0

+  cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd',
textRange) >= 0

and that
line 85
-  if (cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd', 
textRange) == -1 && cursorNode.nextSibling) {

+  if (cursor.compareEndPoints(bStart ? 'StartToStart' : 'StartToEnd', 
textRange) <= 0 && cursorNode.nextSibling) {

helped us much.

Win 7, IE 9.

Original comment by daftcode...@gmail.com on 16 Jul 2012 at 1:23