Hello,
The module is not fully compatible with IE. The Javascript part return errors with IExplorer.
First problem line 11: element.forEach(function(el) should be used instead of element.forEach(el =>.
Second problem line 22: (untested code, not working) lazysizes.plugins.map(function(key, path){
this.loadScript(Drupal.url('libraries/lazysizes/plugins/ '+ path +'.min.js'));
});
should be used instead of for (let [key, path] of Object.entries(lazysizes.plugins)) {
this.loadScript(Drupal.url(`libraries/lazysizes/plugins/${path}.min.js`));
}
Best regards,

Comments

hn0852 created an issue. See original summary.

hn0852’s picture

Issue summary: View changes

  • osman committed 03d9cb5 on 8.x-3.x
    Issue #3084673: Internet Explorer compatibility
    
osman’s picture

Hi @hn0852, thanks for catching this.
I just pushed an update fixing those issues, and some more I found in the javascript.
Could you give a shot and let me know if it works on IE too?

hn0852’s picture

Hello,
thanks for the quick fix, it still doesn't work.
Problem 1: In IE, we're not able to use template literals .
Problem 2 : In IE, Object.entries does not exist, it return an error.
You should declare it if not exist:

      if (!Object.entries)
        Object.entries = function( obj ){
          var ownProps = Object.keys( obj ),
              i = ownProps.length,
              resArray = new Array(i); // preallocate the Array
          while (i--)
            resArray[i] = [ownProps[i], obj[ownProps[i]]];

          return resArray;
        };

Problem 3: line 53: ([key, path]) declaration not compatible with IE

So i corrected the code with
Object.entries(lazysizes.plugins).forEach(function (key, path) {
utils.loadScript(Drupal.url('web/libraries/lazysizes/plugins/'+path+'.min.js'));
});
but "path" now return "0". I'm trying to find a workaround.

You should use

        Object.entries(lazysizes.plugins).forEach(function (path, key) {
          utils.loadScript(Drupal.url('libraries/lazysizes/plugins/'+path[1]+'.min.js'));
        });

instead (tested and working with unveilhooks plugin use)

Edit: I must use web/libraries instead of libraries for code to work. is it a new issue?
H.S question: When do you plan to release the 3.x version?
Best regards,

osman’s picture

@hn0852, just pushed a fix based on your recommendations. Could you try again?

osman’s picture

I must use web/libraries instead of libraries for code to work. is it a new issue?

As long as the libraries folder is in your project's docroot, then all is good.

When do you plan to release the 3.x version?

I plan to release 3.0 when all 3.x issues are resolved.

  • osman committed 8b08cd9 on 8.x-3.x
    Issue #3084673 by osman: Internet Explorer compatibility
    
    Fixes template...
hn0852’s picture

@osman
Thx, it's working now

hn0852’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.