IgniteUI / ignite-ui

Ignite UI for jQuery by Infragistics
https://bit.ly/2kuu1fT
Other
477 stars 84 forks source link

infragistics.lob contains duplicate function name and throws error in IE11 #2178

Closed Lipata closed 2 years ago

Lipata commented 2 years ago

Description

Any sample that is using infragistics.lob.js is throwing the following error under IE11: Multiple definitions of a property not allowed in strict mode.

There is the following duplication:

$c("XmlaPropertiesCollection:hm", "Object", {
...
getEnumerator: function() {
    return this.e.getEnumerator()
},
getEnumerator: function() {
    return this.e.getEnumerator()
}
...

Steps to reproduce

  1. Open the attached sample under IE11
  2. See the browser console.

Result

Multiple definitions of a property not allowed in strict mode error is thrown in the infragistics.lob.js file.

Expected result

No error and the sample is loaded.

Attachments

combo.zip

Add use strict PR.

Lipata commented 2 years ago

@gmurray81 any idea, why there is a duplication?

gmurray81 commented 2 years ago

hmm.. in general one of those is supposed to have been omitted if its is a simple delegate to another. But perhaps something is confusing it in this sceneario and its leaving both properties. It's also possible we only started omitting simple delegates in the TS translation rather than the JS one... maybe my memory is faulty. I'm out of office today, will try to look at it tomorrow. Maybe @igandrews remembers off the top of his head if we started omitting an explicit impl if it just delegates and the implicit impl in the TS output, but I think we were doing this in JS also.

igandrews commented 2 years ago

No it should omit that in JS too. We even have some unit tests for such things but guessing there's just something different about this scenario.

gmurray81 commented 2 years ago

note, it may have been doing that for this scenario forever, because this is benign apart from the fact that strict mode doesn't like it. It also means probably this scenario isn't happening for TS? Since that has always been strict mode, IIRC. Unless we don't translate this class there.

igandrews commented 2 years ago

Yeah I think the issue is that the explicit interface impl doesn't delegate to the public one. This isn't an issue for TS because the GetEnumerator for IEnumerable and IEnumerable\<T> are named differently.

@Lipata I think you can just change the source for that collection:

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }
gmurray81 commented 2 years ago

Thanks for looking into it @igandrews !

Lipata commented 2 years ago

@gmurray81, @igandrews thank you both!

Lipata commented 2 years ago

@gmurray81, @igandrews I've updated the attached file (combo.zip) with local pretified resources and included all of them in the HTML. When opened in the IE11 you can see that there are several places where we have duplicate functions. In the case with the getEnumarator() it is a real duplication, while in other cases, like following there is a difference in the method body:

  compareTo: function(a) {
      return $$t.$ny._compareTo1(this, a)
  },
  compareTo: function() {
      return this._compareTo1.apply(this, arguments)
  }

Can this make it for the next SR? Thank you!

igandrews commented 2 years ago

I checked in some changes that should address these though I can't validate that locally as I can't gen the bundle files.

Lipata commented 2 years ago

Thank you, @igandrews. When you have XPlat build for the service release, we will test it.

Lipata commented 2 years ago

@igandrews everything is working with the latest build. Thank you!