On this page

All pages






Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space TDDM and version 1

Totara supports a small set of ES6 and later features despite the fact that not all of our supported browsers provide there features natively.


We achieve this by using

the polyfils

a combination of core-js polyfills and those provided on https://developer.mozilla.org.

All ES6+ polyfils have been added to lib/javascript_polyfill/src/ and are included on every page when using IE11.

The following ES6 API can be used within Totara:

Table of Contents

Page Tree
root@parent

CustomEvent

Included support for the CustomEvent() constructor.
Available in Totara 12 and all later versions.

API document

Element.closest

Included support for the Element.closest() method.
Available in Totara 12 and all later versions.

API document

Element.matches

Included support for the Element.matches() method.
Available in Totara 12 and all later versions.

API document

Element.remove

Included support for the Element.remove() method.
Available in Totara 12 and all later versions.

API document

Fetch API

Included support for the Fetch API.
Available in Totara 12 and all later versions.

API document

Object.assign

Included support for the Object.assign() method.
Available in Totara 12 and all later versions.

API document

Promise

Included support for the Promise constructor.
Available in Totara 12 and all later versions.

API document

String.startsWith

Included support for the String.startsWith() method.
Available in Totara 12 and all later versions.

API document

String.endsWith

Included support for the String.endsWith() method.
Available in Totara 12 and all later versions.

API document

String.includes

Included support for the String.includes() method.
Available in Totara 13 and all later versions.

API document

Array.includes

Included support for the Array.includes() method.
Available in Totara 13 and all later versions.

API document

Array.find

Included support for the Array.find() method.
Available in Totara 13 and all later versions.

API document

Array.findIndex

Included support for the Array.findIndex() method.
Available in Totara 13 and all later versions.

API document

NodeList.forEach

Included support for the NodeList.forEach() method.
Available in Totara 13 and all later versions.

API document

Object.entries

Included support for the Object.entries() method.
Available in Totara 13 and all later versions.

API document

Object.values

Included support for the Object.values() method.
Available in Totara 13 and all later versions.

API document

Number.isFinite

Included support for the Number.isFinite() method.
Available in Totara 13 and all later versions.

API document

Number.isInteger

Included support for the Number.isInteger()
Available in Totara 13 and all later versions.

API document

Number.isNaN

Included support for the Number.isNaN() method.
Available in Totara 13 and all later versions.

API document

Number.parseFloat

Included support for the Number.parseFloat() method.
Available in Totara 13 and all later versions.

API document

Number.parseInt

Included support for the Number.parseInt() method.
Available in Totara 13 and all later versions.

API document

Available polyfills

PolyfillFunctional overviewImplementationAvailable since Totara version

Array.find

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findcore-js13
Array.findIndexhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndexcore-js13
Array.fromhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fromcore-js14
Array.includeshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includescore-js13
CustomEventhttps://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEventOn MDN overview page12
Element.closesthttps://developer.mozilla.org/en-US/docs/Web/API/Element/closestOn MDN overview page12
Element.matcheshttps://developer.mozilla.org/en-US/docs/Web/API/Element/matchesOn MDN overview page12
Element.removehttps://developer.mozilla.org/en-US/docs/Web/API/ChildNode/removeOn MDN overview page12
Fetch APIhttps://developer.mozilla.org/en-US/docs/Web/API/Fetch_APIhttps://github.com/github/fetch12
Maphttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Mapcore-js14
NodeList.forEachhttps://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEachcore-js13
Number.isFinitehttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinitecore-js13
Number.isIntegerhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isIntegercore-js13
Number.isNaNhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaNcore-js13
Number.parseFloathttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloatcore-js13
Number.parseInthttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseIntcore-js13
Object.assignhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assigncore-js12
Object.createhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/createcore-js14
Object.entrieshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entriescore-js13
Object.valueshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valuescore-js13
Promisehttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promisehttps://github.com/stefanpenner/es6-promise12
Sethttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Setcore-js14
String.startsWithhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWithcore-js12
String.endsWithhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWithcore-js12
String.fromCodePointhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePointcore-js14
String.includeshttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includescore-js13