Wicket
  1. Wicket
  2. WICKET-3820

New Chrome merges text in replaceOuterHtml, breaking wicket-ajax

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.17, 1.5-RC5.1
    • Fix Version/s: 1.4.18, 1.5-RC6
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Chrome 13.0.782.24

      Description

      Chrome 13.0.782.24 beta changes the way "element.outerHTML = text" is handled in a way that breaks Wicket's AJAX rendering compared to Chrome 12.0.782.100 (stable).

      Before the outerHTML assignment that replaces the DOM content, Wicket.replaceOuterHtmlSafari() grabs element.nextSibling. After the outerHTML assignment, it iterates through the new element siblings until the previous "next" is encountered. However, when the new text contains trailing whitespace, and the "previous next" is a text node, the new version of Chrome merges the two text nodes into a single text node, invalidating the iteration's termination condition. This eventually leads to a null reference, breaking subsequent Javascript/AJAX functionality.

      Is it a good idea to simply add "while (next.nodeType == 3) next = next.nextSibling;" after the next assignment in Wicket.replaceOuterHtmlSafari? This just makes the "previous next" reference something other than a text node.

      1. chromeajax.patch
        0.5 kB
        Dan Retzlaff
      2. chromeajax.zip
        9 kB
        Dan Retzlaff

        Issue Links

          Activity

          Dan Retzlaff created issue -
          Dan Retzlaff made changes -
          Field Original Value New Value
          Attachment chromeajax.zip [ 12483231 ]
          Dan Retzlaff made changes -
          Attachment chromeajax.patch [ 12483234 ]
          Dan Retzlaff made changes -
          Description Chrome 13.0.782.24 beta changes the way "element.outerHTML = text" is handled in a way that breaks Wicket's AJAX rendering compared to Chrome 12.0.782.100 (stable).

          Before the outerHTML assignment that replaces the DOM content, Wicket.replaceOuterHtmlSafari() grabs element.nextSibling. After the outerHTML assignment, it iterates through the new element siblings until the previous "next" is encountered. However, when the new text contains trailing whitespace, and the "previous next" is a text node, the new version of Chrome merges the two text nodes into a single text node, invalidating the iteration's termination condition. This eventually leads to a null reference, breaking subsequent Javascript/AJAX functionality.

          Is it a good idea to simply add "while (next.nodeType == 3) next = next.nextSibling;" after the next assignment in Wicket.replaceOuterHtmlSafari? (I haven't had a chance to test this.)
          Chrome 13.0.782.24 beta changes the way "element.outerHTML = text" is handled in a way that breaks Wicket's AJAX rendering compared to Chrome 12.0.782.100 (stable).

          Before the outerHTML assignment that replaces the DOM content, Wicket.replaceOuterHtmlSafari() grabs element.nextSibling. After the outerHTML assignment, it iterates through the new element siblings until the previous "next" is encountered. However, when the new text contains trailing whitespace, and the "previous next" is a text node, the new version of Chrome merges the two text nodes into a single text node, invalidating the iteration's termination condition. This eventually leads to a null reference, breaking subsequent Javascript/AJAX functionality.

          Is it a good idea to simply add "while (next.nodeType == 3) next = next.nextSibling;" after the next assignment in Wicket.replaceOuterHtmlSafari? This just makes the "previous next" reference something other than a text node.
          Dan Retzlaff made changes -
          Comment [ Tested against Chrome 13.0.78.24 ]
          Martin Grigorov made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Martin Grigorov [ mgrigorov ]
          Fix Version/s 1.4.18 [ 12316329 ]
          Fix Version/s 1.5-RC6 [ 12316657 ]
          Resolution Fixed [ 1 ]
          Martin Grigorov made changes -
          Link This issue is duplicated by WICKET-3943 [ WICKET-3943 ]
          Martin Grigorov made changes -
          Link This issue is duplicated by WICKET-3985 [ WICKET-3985 ]

            People

            • Assignee:
              Martin Grigorov
              Reporter:
              Dan Retzlaff
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development