@syncfusion/ej2-base 29.1.33 → 29.1.35

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.
@@ -3754,17 +3754,19 @@ function getComponent(elem, comp) {
3754
3754
  let instance;
3755
3755
  let i;
3756
3756
  const ele = typeof elem === 'string' ? document.getElementById(elem) : elem;
3757
- for (i = 0; i < ele.ej2_instances.length; i++) {
3758
- instance = ele.ej2_instances[parseInt(i.toString(), 10)];
3759
- if (typeof comp === 'string') {
3760
- const compName = instance.getModuleName();
3761
- if (comp === compName) {
3762
- return instance;
3757
+ if (ele && ele.ej2_instances) {
3758
+ for (i = 0; i < ele.ej2_instances.length; i++) {
3759
+ instance = ele.ej2_instances[parseInt(i.toString(), 10)];
3760
+ if (typeof comp === 'string') {
3761
+ const compName = instance.getModuleName();
3762
+ if (comp === compName) {
3763
+ return instance;
3764
+ }
3763
3765
  }
3764
- }
3765
- else {
3766
- if (instance instanceof comp) {
3767
- return instance;
3766
+ else {
3767
+ if (instance instanceof comp) {
3768
+ return instance;
3769
+ }
3768
3770
  }
3769
3771
  }
3770
3772
  }