@syncfusion/ej2-querybuilder 33.1.44 → 33.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4132,31 +4132,33 @@ let QueryBuilder = class QueryBuilder extends Component {
4132
4132
  if (this.portals && this.portals.length) {
4133
4133
  this.clearQBTemplate();
4134
4134
  }
4135
- let qbDdlElems = this.element.querySelectorAll('.qb-dropdownlist');
4136
- if (!qbDdlElems || qbDdlElems.length === 0) {
4137
- qbDdlElems = document.querySelectorAll('.qb-dropdownlist');
4138
- }
4139
- for (i = 0; i < qbDdlElems.length; i++) {
4140
- const ddlElem = qbDdlElems[i];
4141
- const targetInput = ddlElem.tagName === 'INPUT' ? ddlElem : ddlElem.querySelector('input');
4142
- if (targetInput) {
4143
- const ddlInst = getComponent(targetInput, 'dropdownlist');
4144
- if (ddlInst) {
4145
- if (ddlInst.close) {
4146
- ddlInst.close = null;
4147
- }
4148
- if (ddlInst.open) {
4149
- ddlInst.open = null;
4150
- }
4151
- if (ddlInst.change) {
4152
- ddlInst.change = null;
4135
+ const qbDdlElems = this.element.querySelectorAll('.qb-dropdownlist');
4136
+ if (qbDdlElems && qbDdlElems.length > 0) {
4137
+ for (i = 0; i < qbDdlElems.length; i++) {
4138
+ const ddlElem = qbDdlElems[i];
4139
+ if (this.element.contains(ddlElem)) {
4140
+ const targetInput = ddlElem.tagName === 'INPUT' ? ddlElem : ddlElem.querySelector('input');
4141
+ if (targetInput) {
4142
+ const ddlInst = getComponent(targetInput, 'dropdownlist');
4143
+ if (ddlInst) {
4144
+ if (ddlInst.close) {
4145
+ ddlInst.close = null;
4146
+ }
4147
+ if (ddlInst.open) {
4148
+ ddlInst.open = null;
4149
+ }
4150
+ if (ddlInst.change) {
4151
+ ddlInst.change = null;
4152
+ }
4153
+ ddlInst.destroy();
4154
+ }
4153
4155
  }
4154
- ddlInst.destroy();
4155
4156
  }
4156
4157
  }
4157
4158
  }
4158
- const popupElement = document.querySelectorAll('.qb-dropdownlist.e-popup');
4159
- if (popupElement) {
4159
+ // Cleanup orphaned popup elements
4160
+ const popupElement = this.element.querySelectorAll('.e-popup.e-dropdownlist');
4161
+ if (popupElement && popupElement.length > 0) {
4160
4162
  for (i = 0; i < popupElement.length; i++) {
4161
4163
  popupElement[i].remove();
4162
4164
  }