? ? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
13 Jun 2018

Pull Request for Issue # .

Please read this excellent article form

@jakearchibald
https://jakearchibald.com/2017/es-modules-in-browsers/

Summary of Changes

Since we already have a project to convert the javascript files to ES6 I thought it will be good to also start the discussion about delivering that code to the browser.

There is a really painful problem with imports:

  • joomla has an overriding mechanism (template/js) which is hard to replicate (without performance cost at least)
  • Joomla also supports installations on subdirectories (same problem as above)

@dneukirchen @yvesh and me had a discussion about possible solutions but I wanted to get more ideas before starting coding them for benchmarking...

Testing Instructions

Apply this path and try to create or edit a banner.
Observe the head that you have:
screen shot 2018-06-13 at 02 47 19

Everything works.

Repeat in IE6...

Also removed the conditionals as those are dropped in IE10 and Joomla 4 support >IE11

Expected result

Actual result

Documentation Changes Required

f4304c6 13 Jun 2018 avatar dgrammatiko ES6
avatar dgrammatiko dgrammatiko - open - 13 Jun 2018
avatar dgrammatiko dgrammatiko - change - 13 Jun 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 13 Jun 2018
Category Libraries JavaScript
avatar dgrammatiko dgrammatiko - change - 13 Jun 2018
Labels Added: ? ?
51c41de 13 Jun 2018 avatar dgrammatiko cs
avatar Fedik
Fedik - comment - 13 Jun 2018

hmm, if I right understood the code, you assume that every ES6 script is a module, but it is not ?

And I think will be more smart to use attribute array('type' => 'module') when add new script to document with $doc->addScript(), than hacky preg_match.

just my first thoughts, not tested

avatar dgrammatiko
dgrammatiko - comment - 13 Jun 2018

@Fedik the thing is that we automatically check if there is an ES6 version of each file and then create both tags (type="module" and for fallback nomodule). Passing the attribute when adding a script will only load the one version, but for compatibility we still need both script tags. Maybe there is a better way, this was late night code...

avatar dgrammatiko dgrammatiko - change - 13 Jun 2018
The description was changed
avatar dgrammatiko dgrammatiko - edited - 13 Jun 2018
avatar dgrammatiko dgrammatiko - change - 13 Jun 2018
The description was changed
avatar dgrammatiko dgrammatiko - edited - 13 Jun 2018
avatar dgrammatiko dgrammatiko - change - 13 Jun 2018
The description was changed
avatar dgrammatiko dgrammatiko - edited - 13 Jun 2018
avatar dgrammatiko dgrammatiko - change - 9 Jul 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-07-09 09:37:31
Closed_By dgrammatiko
avatar dgrammatiko dgrammatiko - close - 9 Jul 2018

Add a Comment

Login with GitHub to post a comment