Possible DOM leak upon closing a tab (II) [closed]

asked 2013-02-18 08:44:03 +0800

cvarona gravatar image cvarona
554 1 6

updated 2013-02-18 16:15:05 +0800

Hi again,

when I raised the question concerning dom nodes leaked upon closing a tabbox' tab by means other than clicking on its close button I forgot to mention that, should the form to be loaded into the associated tabpanel take long enough as to make a progress box appear, the box itself is likely to be leaked as well (though not always).

The example in my previous question can be easily modified to make it possible to test this (you might need several tries, but sooner or later it will do):

<window title="My First Window" border="normal" width="600px">
    import org.zkoss.zk.ui.event.*;

    int cnt = 0;

    public class YesNo implements EventListener {

        private Tab _tab;

        public YesNo( Tab tab ) {
            _tab = tab;

        public void onEvent( Event event ) {        
            if( "onYes".equals( event.getName() ) ) {

    public class AreYouSure implements EventListener {

        private Tab _tab;

        public AreYouSure( Tab tab ) {
            _tab = tab;

        public void onEvent( Event event ) {
            Messagebox.show( "Are you sure?", "Beware !", Messagebox.NO | Messagebox.YES, Messagebox.EXCLAMATION, Messagebox.NO, new YesNo( _tab ) );

    public class DirectClose implements EventListener {

        private Tab _tab;

        public DirectClose( Tab tab ) {
            _tab = tab;

        public void onEvent( Event event ) {

    public void newTab( long delay ) {

        if( delay > 0 ) {
            Thread.currentThread().sleep( delay );

        Tab tab = new Tab( String.valueOf( cnt ) );
        tab.setClosable( true );
        tab.addEventListener( "onClose", new AreYouSure( tab ) );
        tabbox.getTabs().appendChild( tab );

        Tabpanel tabpanel = new Tabpanel();
        Button b = new Button( "Close" );
        b.setParent( tabpanel );
        b.addEventListener( "onClick", new DirectClose( tab ) );

        tabbox.getTabpanels().appendChild( tabpanel );
        <button label="New tab" onClick="newTab( 0 );" />
        <button label="New tab, with delay" onClick="newTab( 2000 );" />
    <tabbox id="tabbox">
        <tabs />
        <tabpanels />

My zk.xml specifies the following:

    <p style="color:red">Sorry, JavaScript must be enabled.</p>
    <p style="color:red">Lo sentimos, JavaScript debe de estar permitido.</p>

        <script type="text/javascript">
            AU_progressbar = function (id, msg)
                Boot_progressbox(id, msg, 0, 0, true, true);

and this is how a leaked progress box looks like:

progress box leaked

Although the amount leaked in this test case might look unimportant (less than 1MB each time), in a real scenario the actual amount depends on the document fragments being leaked, i.e., in the forms being loaded (usually far more complex than the one depicted in this example). As time goes by and forms are loaded and eventually discarded this little leak grows quite big.

With kind regards

César Varona

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by cvarona
close date 2014-01-21 14:42:51


No idea about this, then?

cvarona ( 2013-03-22 09:24:26 +0800 )edit

3 Answers

Sort by » oldest newest most voted

answered 2013-05-25 17:38:56 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

Push! Push!

link publish delete flag offensive edit

answered 2014-01-15 10:32:52 +0800

vincentjian gravatar image vincentjian
2245 6

This issue seems relating to this jQuery.fragments bug. Refer to jQuery's bug ticket, discussion and stackoverflow.

BTW we are not observing it in ZK 7, as a newer version of jquery (1.10.2) is used in ZK7.

link publish delete flag offensive edit


Nice to know it Vincent, I'll try to upgrade as soon as possible.

cvarona ( 2014-01-21 14:42:10 +0800 )edit

answered 2013-05-27 08:08:51 +0800

cvarona gravatar image cvarona
554 1 6

I've tried it again and it keeps on being like this, also this.

Should I open a bug report?

link publish delete flag offensive edit

Question tools




Asked: 2013-02-18 08:44:03 +0800

Seen: 43 times

Last updated: Jan 15 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More