isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

test(markdown-fixtures): add a test for DOMPurify sanitization #703

Closed seaerchin closed 1 year ago

seaerchin commented 1 year ago

Problem

Right now, we have no tests for the behaviour of the sanitize function, which leads to some behaviour being potentially inconsistent.

This was observed in the frontend sanitize call vs the backend sanitize call, where the frontend call preserves the property async as-is, but the backend call adds the empty string to turn it into async="".

Solution

This PR adds a short test for sanitization to ensure that

  1. this behaviour is known
  2. that this behaviour doesn't affect functionality.

from the html spec, the 2 forms (async and async="") are equivalent and browser support for the async tag as a whole is wide (only edge support is at v12, others start at v1), so this shouldn't be an issue