You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Francisco Diaz Trepat (JIRA)" <ji...@apache.org> on 2007/11/01 22:48:50 UTC

[jira] Commented: (WICKET-1123) Ajax Panel Replacement Issue on Fireforx only (Kind of Complex Scenario, subpanels and tables)

    [ https://issues.apache.org/jira/browse/WICKET-1123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539473 ] 

Francisco Diaz Trepat commented on WICKET-1123:
-----------------------------------------------

This could be a Fix. Without 
// --------------------------------------------------------------------------------
// Hack that demonstrates a possible fix for a problem with Gecko based browsers.
// The problem happens in this line:
//    var fragment = range.createContextualFragment(text);
// If there are many subpanels, the range uncorrectly parses the content, resulting
// in a fragment that contains many childs instead of one.
// The first child is the first subpanel, and the rest are the other subpanels, 
// which are incorrectly hang at the same level as the main panel, instead of being
// childs of it.

//function replaceWicketReplaceOuterHtml() {
  Wicket.replaceOuterHtml = function(element, text) {
    if (Wicket.Browser.isIE()) {
      Wicket.replaceOuterHtmlIE(element, text);
    } else if (Wicket.Browser.isSafari () || Wicket.Browser.isOpera()) {
      Wicket.replaceOuterHtmlSafari(element, text);
    } else /* GECKO */ {
      // create range and fragment
      var range = element.ownerDocument.createRange();
      range.selectNode(element);
      var fragment = range.createContextualFragment(text);

      // The following code seems useless, and then is commented out
        // get the elements to be added
        //var elements = new Array();
        //for (var i = 0; i < fragment.childNodes.length; ++i) 
        //elements.push(fragment.childNodes[i]);

      // move additional subnodes to the correct place in the dom
      if (fragment.childNodes.length > 1) {
        // the for clause intentionally starts from 1,
        // to fix only the wrongly hanging subnodes. 
        for (var i = 1; i < fragment.childNodes.length; ++i) {
          var otherNode = fragment.childNodes[i];

          fragment.childNodes[0].childNodes[0].appendChild(otherNode);
        }
      }

      element.parentNode.replaceChild(fragment, element);
    }
  }
//}

//window.setTimeout(replaceWicketReplaceOuterHtml, 1000);
// --------------------------------------------------------------------------------




> Ajax Panel Replacement Issue on Fireforx only (Kind of Complex Scenario, subpanels and tables) 
> -----------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1123
>                 URL: https://issues.apache.org/jira/browse/WICKET-1123
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta4
>         Environment: Windows XP, Apache Tomcat 5.5 and 6.0.14, Netbeans IDE 5.5 and 6.0 beta2 Only happens on Firefox Browser (Gecko Engine)
>            Reporter: Francisco Diaz Trepat
>         Attachments: GeckoEnginePanelReplacementBug_QS.zip
>
>
> > Hi. I'm going to try to explain the best that I can and without posting code 
> > at first the issue that is happening.
> >
> > I have the following panels A and C. A has two instances of B nested inside 
> > of it. C is empty:
> >
> > [
> >
> > ==PANEL-A==
> >
> >     [
> >
> >     ==PANEL-B1==
> >
> >     ]
> >
> >     [
> >
> >     ==PANEL-B2==
> >
> >     ] 
> >
> > ]
> >
> >
> > [
> > ==PANEL-C==
> > ]
> > 
> > What happens is that on another Panel that represent the Page content, lets
> > call it ContentPanel I need to toggle between panels A and C with the click 
> > of an Ajax Link.
> >
> > The first state is with panel C that it is empty (actually with lots of 
> > HiddenFields, but empty visually). On click I need to Show the A panel that
> > has viewable content. Finally on another click I need to go back to the 
> > original state of C panel.
> >
> > So far so good. The issue is as follows: 
> >
> > The problem happens on Firefox only (latest version 2.0.0.8) (on IE 6 and 7
> > it is not an issue as everything works fine).
> >
> > What happens is that I click on the link, and panel A shows perfectly. But 
> > when I click again to put the C panel back, the A panel gets Partially 
> > removed, that is panel A's first panel B instance B1 gets removed, but B2 is
> > not removed and it is still visible, plus I get the C panel, as C panel 
> > doesn't have viewable content it doesn't add to the visual problem. *Ej*: 
> >
> > [
> >
> > ==PANEL-A==
> >
> >
> >     [
> >
> >     ==PANEL-B2==
> >
> >     ] 
> >
> > ]
> >
> > [
> > ==PANEL-C==
> > ]
> >
> > Now If I click again, I get Panel A with "2 instances of B2" as panel B2 was 
> > not removed.
> > [
> >
> > ==PANEL-A== 
> >
> >     [
> >
> >     ==PANEL-B1==
> >
> >     ]
> >
> >     [
> >
> >     ==PANEL-B2==
> >
> >     ]
> > 
> >     [
> >
> >     ==PANEL-B2==
> >
> >     ]
> >
> > ]
> >
> > So and so forth every click and click, I get panel A partially removed and
> > when added again I have another instance of B2 as it is never removed. 
> >
> >

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.