Skip to content

Commit

Permalink
MDL-67137 javascript: Add missing polyfills
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Nov 5, 2019
1 parent e943e7d commit 2665f35
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/mdn-polyfills/
lib/emoji-data/
lib/h5p/
media/player/videojs/amd/src/video-lazy.js
Expand Down
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/mdn-polyfills/
lib/emoji-data/
lib/h5p/
media/player/videojs/amd/src/video-lazy.js
Expand Down
18 changes: 18 additions & 0 deletions lib/mdn-polyfills/polyfill.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions lib/mdn-polyfills/readme_moodle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
The steps are essentially:
1) Install mdn-polyfills package

npm install --no-save mdn-polyfills

2) Join them all together:

cd node_modules/mdn-polyfills
cat CustomEvent.* Element.* Function.* HTMLCanvasElement.* MouseEvent.* Node.prototype.* NodeList.* > ../../lib/mdn-polyfills/polyfill.js

3) Uninstall the package again

npm uninstall --no-save mdn-polyfills
3 changes: 3 additions & 0 deletions lib/outputrequirementslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,9 @@ public function get_top_of_body_code(renderer_base $renderer) {
$output .= html_writer::script('', $this->js_fix_url('/lib/babel-polyfill/polyfill.min.js'));
}

// Include the MDN Polyfill.
$output .= html_writer::script('', $this->js_fix_url('/lib/mdn-polyfills/polyfill.js'));

// YUI3 JS needs to be loaded early in the body. It should be cached well by the browser.
$output .= $this->get_yui3lib_headcode();

Expand Down
6 changes: 6 additions & 0 deletions lib/thirdpartylibs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@
<license>MIT</license>
<version>6.26.0</version>
</library>
<library>
<location>mdn-polyfills</location>
<name>mdn-polyfill</name>
<license>MIT</license>
<version>5.19.0</version>
</library>
<library>
<location>emoji-data</location>
<name>Emoji data</name>
Expand Down

0 comments on commit 2665f35

Please sign in to comment.