alpheios-project / embed-lib

Alpheios Embedded Library
Other
6 stars 0 forks source link

conflict with Joomla multimedia library #61

Closed balmas closed 5 years ago

balmas commented 5 years ago

An embedded library beta tester reports that the embedded library fails activation on a page with the joomla multimedia player included.

https://www.joomlaworks.net/extensions/free/allvideos https://github.com/joomlaworks/allvideos

(@kirlat see Slack discussion on this too...)

kirlat commented 5 years ago

@balmas: I did the quick check of the code and it seems the error is somehow related to MooTools, a JS framework that the host site is probably using. The error is originated within the dataModules() getter that should select all modules that are "Data Modules":

get dataModules () {
  return Array.from(this.modules.values()).filter(m => m.ModuleClass.isDataModule)
}

The problem is that Array.from(), that is used there, instead of calling a native JS function is somehow going to Array.from of MooTools. Please see a screenshot below: image Will continue my investigation.

kirlat commented 5 years ago

After Googling it out it seems that MooTools has it's own implementation of Array that conflicts with Array defined in ES6. MooTools fixed the issue in version 1.6.0 by renaming Array.from() into Array.convert() (please see the Warning section in the following link: http://www.kleine-pause.de/joomla_01/index.php?view=newsfeed&catid=6%3Arelated-projects&id=14-mootools-blog&option=com_newsfeeds&Itemid=49

Array.from deprecated, now called Array.convert: Following the conclusion of the ES6 specs we know now that Array.from will have a different implementation than the one MooTools uses. Because of this we renamed Array.from to Array.convert to not overwrite the Native implementation.

lapis.practomime.com uses an older version of MooTools 1.4.5 that do not have this conflict resolved. MooTools is probably loaded by one of the Joomla plugins. The simplest solution would be to upgrade to the latest version of the plugin that will, hopefully, use MooTools 1.6 or newer.

I'm not sure if there is anything that can be done other than that. It seems that MooTools is breaking not anything within the Alpheios library specifically, but the whole built-in JS ES6 Array.from() functionality. This is pretty big, I think. We can see this error on other sites with older version of MooTools too.

balmas commented 5 years ago

Thank you @kirlat ! I agree we cannot do anything on our side here. Will communicate this and we can close this issue.