#2156: [IE] Can't remove styles after calling GetData() --------------------------------+------------------------------------------- Reporter: pmcelhaney | Type: Bug Status: new | Priority: Normal Milestone: | Component: Core : Styles Version: FCKeditor 2.5 Beta | Keywords: Confirmed IE --------------------------------+-------------------------------------------
Comment(by pjhinton): Replying to [comment:4 pmcelhaney]: > I figured out what's happening. GetData() leaves _fckhtmljob attributes behind, which in turn triggers bug #2092. I have reproduced the issue described in the quoted comment. Here is a more detailed discussion of what is happening along with some proposed fixes. When `FCK.GetData()` is called, `FCKXHtml._AppendNode()` gets invoked as part of an operation that copies the editor's internal HTML DOM document to an XML document that will be used to create the XHTML source string. `FCKXHtml._AppendNode()` adds a property, named `_fckxhtmljob` to each DOM node object that corresponds to an element. These properties are not removed after the copy is complete. The presence of these properties has an adverse side effect in Internet Explorer. The function `FCK.Style.RemoveFromRange()` does not remove a styling element (e.g. `strong`) when a call to `FCKDomTools.HasAttributes()` returns `true`. A `true` result is obtained because Internet Explorer includes the `_fckxhtmljob` property in the styling element's `attributes` `NamedNodeMap`, and the `Attr` object corresponding to the `_fckxhtmljob` attribute has the `specified` property set to `true`. The equivalence between an element object's property and an element's attributes is documented in the MSDN docs for HTML and CSS: [http://msdn.microsoft.com/en- us/library/ms533026(VS.85).aspx#Accessing_Element_Pr] I have attached two patch files that contain separate candidate fixes for this problem. The diffs are based on the current state of trunk sources as this comment was being written. The first patch defines a new function in `fckxhtml_ie.js` called `FCKXHtml._RemoveXHtmlJobProperties()`. It recursively walks a DOM node object and its descendants to remove the `_fckxhtmljob` properties. It is invoked by `FCKXHtml.GetXHTML()` once the document copy operation is complete. It is called only when the browser is Internet Explorer. The second patch modifies `FCKDomTools.HasAttributes()` in `fckdomtools.js` so that it skips over all attributes whose names start with `_fck` when the browser is Internet Explorer. This code builds upon an existing conditional that applies for IE. The use of `StartsWith( '_fck')` is based on its use in `FCKXHtml._AppendAttributes()`. To me, the first patch seems like the Right Thing to do because it forces `FCKXHtml` to clean up after itself. However, the second approach might be safer in situations where `FCK.GetData()` being called in the background. Theoretically, one could have a scenario when a user is attempting to perform a style change while an `interval` callback invokes `GetData()` to perform an autosave on the content. If you have any comments or questions on these patches, please feel free to e-mail me. My employer, Compendium Blogware, uses FCKeditor in its application and [http://blogging.compendiumblog.com/blog/blogging-from- the-server-side/0/0/html-attributes-in-unexpected-places counts itself among those who have been affected by this bug]. Thanks! -- Ticket URL: <http://dev.fckeditor.net/ticket/2156#comment:7> FCKeditor <http://www.fckeditor.net/> The text editor for Internet ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ FCKeditor-Trac mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/fckeditor-trac
