liferay-ui:input-editor causes invalid DOM diff during Ajax postback when used with ICEfaces
Description
Environment
None
is related to
Activity
Show:
Fixed
Pinned fields
Click on the next to a field label to start pinning.
Details
Details
Assignee

Reporter

Components
Affects versions
Priority
Zendesk Support
Linked Tickets
Zendesk Support

Linked Tickets
Created September 14, 2012 at 6:57 AM
Updated October 27, 2012 at 11:07 AM
Resolved October 27, 2012 at 11:01 AM
The liferay-ui:input-editor is a Facelet composite component, but references a Java-based liferay-ui-internal:input-editor UIComponent. The InputEditorInternalRenderer.java class invokes a RequestDispatcher in order to capture the output of the out-of-the-box liferay-ui:input-editor JSP tag.
During the RENDER_PHASE of the portlet lifecycle, the liferay-ui:input-editor JSP tag renders markup that looks like this:
<div class=""> <textarea id="_myportlet_WAR_myportlet_A2464:f1:comments1" name="_myportlet_WAR_myportlet_A2464:f1:comments1" style="display: none;"></textarea> </div>
Additionally, it appends <script>...</script> elements to the value of the "LIFERAY_SHARED_AUI_SCRIPT_DATA" request attribute so that they will appear at the bottom of the rendered portal page.
But during the RESOURCE_PHASE of the portlet lifecycle (triggered by f:ajax), the liferay-ui:input-editor JSP tag renders markup that INCLUDES the aforementioned <script>...</script> elements. The reason for this, is because the "LIFERAY_SHARED_AUI_SCRIPT_DATA" approach cannot be used during Ajax.
The problem is that this additional markup causes ICEfaces to detect a DOM diff, and which causes the CKEditor(s) to be unnecessarily replaced in the DOM of the browser. The fix would be to have the InputEditorInternalRenderer.java class remove the additional markup during the RESOURCE_PHASE for any component instances that do not need to be re-initialized.
An additional fix is that any <script>...</script> elements must be moved out of the response markup to the ICEfaces JavaScriptRunner so that it does not become a factor with the ICEfaces DOM-diff algorithm.