Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4225

zul.wgt.Toolbar.removeChild throws exception


    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • ZK Client Engine
    • None

      zul.wgt.Toolbar.removeChild(child) throws exception once customer client code applies insertBefore(child, sibling) on Toolbar!

      Reason is, that Toolbar.removeChild(child) expects non-empty node for child:
      {{ removeChild: function (child)

      { var popup = this.$n('pp'); childOnPopup = child.$n().parentNode == popup; if (childOnPopup && popup.children.length == 1) jq(this.$n()).removeClass(this.$s('overflowpopup-on')).addClass(this.$s('overflowpopup-off')); this.$supers('removeChild', arguments); }


      As removeChild(child) is used inside insertBefore(child, sibling), which conditionally applies appendChild(child) before, child.node can be NULL, which is not checked by Toolbar.removeChild(child)!

      Some background: Because Toolbar was missing "overflow" feature before 8.6, we developed same functionality some time ago. We considered to use native "overflow" feature from 8.6, but its not flexible enough so far (e.g. fix markup of overflow button).

      As workaround, we temporarily replaced Toolbar.removeChild(child):

      {{zk.afterLoad('zul.wgt', function () {
      new zul.wgt.Toolbar(); // force init
      zul.wgt.Toolbar.prototype.removeChild = function()

      { this.$supers('removeChild', arguments); }


            Unassigned Unassigned
            fse fse
            0 Vote for this issue
            1 Start watching this issue