Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#1510 closed defect (duplicate)

IE BUG in _getFirstAncestor() when selection empty

Reported by: guest Owned by: gogo
Priority: normal Milestone: 0.96
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

This is IE only. Let's say you have code like this.

var selection  = this.editor.getSelection();
this.editor._getFirstAncestor(selection,['span']);	

If the selection is empty, I mean you just clicked into the document, _getFirstAncestor() will return null on IE8. Even though it is surrounded by <span>. Firefox behaves right and returns the ancestor node.

getSelection() seems to be ok as it returns a selection object even in IE.

Change History (2)

comment:1 Changed 7 years ago by gogo

  • Resolution set to duplicate
  • Status changed from new to closed

I strongly suspect this will be related to ticket:1508 owing to the fact that _getFirstAncestor also uses createRange, which does that focus when a None selection (just an insertion point) is presented to it.

That would focus the editor as a whole and probably produce this null return.

Microsoft made definite changes to IE8's focus model,

Internet Explorer 8 and later. When a Web page is displayed in IE8 mode, an object cannot receive focus when sCanEdit is set to false. When pages are displayed in earlier document compatibility modes, objects can receive focus when sCanEdit is false.

http://msdn.microsoft.com/en-us/library/ms533690(VS.85).aspx

comment:2 Changed 7 years ago by gogo

See #1508, #1471

Note: See TracTickets for help on using tickets.