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

HTML tidy removes inline style tags

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78700-tidy_no_clean-401
    • MDL-78700-tidy_no_clean
    • Hide

      Test steps

      1. Install PHP extension php-tidy so that Tidy support: enabled appears in Site administration > Server > PHP info.

      2. Go to Site administration > Plugins > Filters > Manage filters and ensure filter "HTML tidy" is set to "On".

      3. Create a course.

      4. Add a page activity, give it a name ("Page 1"), then in the editor for the Page content field switch to HTML source view (by clicking the </> toolbar button), and copy and paste the content below:

      <table>
        <thead>
          <tr>
            <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">1</th>
            <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">2</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>3</strong></td>
            <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>4</strong></td>
          </tr>
        </tbody>
      </table>

      5. Click Save and display.

      Expected results

      The table is shown with borders around each cell (as shown in attached file screenshot-1.png).

      Show
      Test steps 1. Install PHP extension php-tidy so that Tidy support: enabled appears in Site administration > Server > PHP info . 2. Go to Site administration > Plugins > Filters > Manage filters and ensure filter "HTML tidy" is set to "On". 3. Create a course. 4. Add a page activity, give it a name ("Page 1"), then in the editor for the Page content field switch to HTML source view (by clicking the </> toolbar button), and copy and paste the content below: <table>   <thead>     <tr>       <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">1</th>       <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">2</th>     </tr>   </thead>   <tbody>     <tr>       <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>3</strong></td>       <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>4</strong></td>     </tr>   </tbody> </table> 5. Click Save and display. Expected results The table is shown with borders around each cell (as shown in attached file screenshot-1.png ).

      This seems to be a side effect of MDL-69951 due to the way how clean option works https://tidy.sourceforge.net/docs/quickref.html#clean

      If HTML tidy filter is enabled, it seems to be removing inline style tags.

      Steps to replicate:

      • Enable HTML tidy filter in your Moodle site.
      • Create a page activity with the following content (HTML format):

        <table>
          <thead>
            <tr>
              <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">1</th>
              <th style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);" scope="col">2</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>3</strong></td>
              <td style="border-width: 3px; border-style: solid; border-color: rgb(51, 51, 51);"><strong>4</strong></td>
            </tr>
          </tbody>
        </table>
        

      • View the activity and confirm that borders are not displayed (style tags are removed).
      • Disable HTML tidy filter.
      • View the activity and confirm that borders are displayed (style tags are not removed).

        1. (I) Passed -- (Master)MDL-78700.png
          37 kB
          Kim Jared Lucas
        2. sandboxtable.png
          50 kB
          Sara Arjona (@sarjona)
        3. screenshot-1.png
          15 kB
          Misha Golenkov
        4. screenshot-2.png
          15 kB
          Misha Golenkov

            leonstr Leon Stringer
            mikhailgolenkov Misha Golenkov
            Misha Golenkov Misha Golenkov
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 58 minutes
                58m

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