CoreFiles by mySites.guru
templates-default.es6.js44 lines, 1,178 bytes, from Joomla_4.0.0-alpha11-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha10
md5
4f293c2b7b8bb393e5c2b09f6e4ac594
sha1
a09ed1d49fab558377311927b41ac489ef6cc2c3
sha256
09dec67e02fd1bf086936087e6fa872abd139f255cf69c28e2dcdc89303eeb21
/**
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION.
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD.
**/

/**
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
((document, submitForm) => {
  'use strict'; // Selectors used by this script

  const buttonDataSelector = 'data-submit-task';
  /**
   * Submit the task
   * @param task
   * @param form
   */

  const submitTask = (task, form) => {
    if (task === 'templates.cancel' || document.formvalidator.isValid(form)) {
      submitForm(task, form);
    }
  };
  /**
   * Register events
   */


  const registerEvents = () => {
    const buttons = [].slice.call(document.querySelectorAll("[".concat(buttonDataSelector, "]")));
    buttons.forEach(button => {
      button.addEventListener('click', e => {
        e.preventDefault();
        const task = e.target.getAttribute(buttonDataSelector);
        submitTask(task, e.target.form);
      });
    });
  };

  document.addEventListener('DOMContentLoaded', () => {
    registerEvents();
  });
})(document, Joomla.submitform);

The same content is in 5 releases, Joomla 4.0.0-alpha8 to 4.0.0-alpha12. See them all, or every version of this file.