Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83668

Tiny is more strict than Atto for onclick JavaScript action (Backport of MDL-80953)

XMLWordPrintable

    • MOODLE_404_STABLE, MOODLE_405_STABLE
    • MOODLE_404_STABLE, MOODLE_405_STABLE
    • MDL-83668-404
    • MDL-83668-405
    • Hide

      Prerequisites

      • Create a course with a page activity
      • Have the TinyMCE as the prefered editor.

      Test instructions

      First part

      • Edit the page activity, change to the source view in the Tiny and add the following text:
      <table>
      <tbody>
      <tr>
      <td class="styleid"> <button class="button" onclick="alert('horray')">click me</button></td>
      </tr>
      </tbody>
      </table>
      • Hit the Save button to switch back to WYSIWYG mode.
      • Go back to the source code button.

      Expected outcome: the onclick attribute vanished.

      Second part

      • Change the settings, go to the Site administration -> Plugins -> Text editors -> TinyMCE editor -> General settings.
      • Change the value of editor_tiny | extended_valid_elements to script[*],p[*],i[*],button[onclick] and click save.
      • Go to the page activity, repeat the steps from above.

      Expected outcome: This time after switching back from the WYSIWYG mode again into the source code mode, the onclick attribute should be still inside the button element.

      Show
      Prerequisites Create a course with a page activity Have the TinyMCE as the prefered editor. Test instructions First part Edit the page activity, change to the source view in the Tiny and add the following text: <table> <tbody> <tr> <td class="styleid"> <button class="button" onclick="alert('horray')">click me</button></td> </tr> </tbody> </table> Hit the Save button to switch back to WYSIWYG mode. Go back to the source code button. Expected outcome: the onclick attribute vanished. Second part Change the settings, go to the Site administration -> Plugins -> Text editors -> TinyMCE editor -> General settings. Change the value of editor_tiny | extended_valid_elements to script [*] ,p [*] ,i [*] ,button [onclick] and click save. Go to the page activity, repeat the steps from above. Expected outcome: This time after switching back from the WYSIWYG mode again into the source code mode, the onclick attribute should be still inside the button element.
    • Hide

      Code verified against automated checks.

      Checked MDL-83668 using repository: https://github.com/srobotta/moodle

      More information about this report

      Built on: Thu 21 Nov 2024 04:31:48 AM UTC

      Show
      Code verified against automated checks. Checked MDL-83668 using repository: https://github.com/srobotta/moodle MOODLE_404_STABLE (0 errors / 0 warnings) [branch: MDL-83668-404 | CI Job ] MOODLE_405_STABLE (0 errors / 0 warnings) [branch: MDL-83668-405 | CI Job ] More information about this report Built on: Thu 21 Nov 2024 04:31:48 AM UTC
    • Show
      Launching automatic jobs for branch MDL-83668 -404 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17296/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58939/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58940/ Behat (Firefox - boost) Launching automatic jobs for branch MDL-83668 -405 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17297/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58941/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/58942/ Behat (Firefox - boost) Built on: Fri Nov 8 04:25:16 PM UTC 2024

      This should be backported.
      The fact that Tiny works differently than the previously known Atto puzzles users after a change.

      https://moodledev.io/general/development/policies/backporting#process-for-requesting-a-non-bug-fix-backport

            strobotta Stephan Robotta
            lucaboesch Luca Bösch
            Luca Bösch Luca Bösch
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            2 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 3 minutes
                2h 3m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.