#503: Unordered list paste: doesn't work correctly in IE
----------------------+-----------------------------------------------------
  Reporter:  tba21cn  |       Owner:  martinkou      
      Type:  Bug      |      Status:  assigned       
  Priority:  Normal   |   Milestone:  FCKeditor 2.6  
 Component:  General  |     Version:  FCKeditor 2.4.1
Resolution:           |    Keywords:  Review?        
----------------------+-----------------------------------------------------
Comment (by martinkou):

 The check is only done against <ul> because orphaned <li> items always
 appear as unordered list items in IE. If we check for <ol> and group those
 items under an ordered list, we would have converted an unordered list
 item to an ordered list item, and that would be wrong.

 The <li> tag processor is executed in the FCKXHtml._AppendNode() function,
 which is used to reconstruct an XML tree from an HTML node in a depth-
 first search manner. The newTarget element is the destination for the <li>
 node to be appended into in the XML tree, and so it must be either a <ul>
 at the correct tree depth that we have just inserted into the XML tree, or
 a new <ul> if a previous <ul> was not found.

 Prove of correctness of the newTarget element:
  1. If a <ul> was inserted previously at the level that the <li>'s parent
 should be, then it must be located at targetNode.lastChild - since we've
 been doing the tree reconstruction in DFS. So newTarget =
 targetNode.lastChild is right.
  1. If targetNode.lastChild is not a <ul>, then it is not possible for a
 suitable <ul> node to exist in the XML tree for inserting the <li>, by
 considering XML nodes before, at, and after targetNode.lastChild in DFS
 order:
     a. Suppose there is a <ul> before targetNode.lastChild in DFS order,
 which is suitable for inserting the <li>, and we inserted it there. Then
 the <li> would have jumped over at least one node in DFS order to go to
 the <ul>, which does not make sense. So this cannot happen by
 contradiction.
     a. targetNode.lastChild itself is not a <ul>, so it's not a suitable
 newTarget.
     a. There is no <ul> after targetNode.lastChild in DFS order because
 we've been reconstructing the XML tree in a DFS-like style.
  1. It follows from point 2 that a new <ul> node would be needed if
 targetNode.lastChild is not a <ul>, so newTarget =
 FCKXhtml.XML.createElement('ul') is correct.

-- 
Ticket URL: <http://dev.fckeditor.net/ticket/503#comment:14>
FCKeditor <http://www.fckeditor.net>
The text editor for Internet
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
FCKeditor-Trac mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fckeditor-trac

Reply via email to