Home

Awesome

This is an idea for mocking HTML data that lets you test whether your layout breaks on any screen size for any unexpected dynamic data.

This script scans the document for class names with a specific pattern and periodically randomizes the content of those elements while meeting the constraints specified in the class name. This can let you quickly test whether your layout breaks for any dynamic content that you may not have thought about. This should ideally be used with a responsive design testing tool such as DevTools or Sizzy/Bizzy.

For eg, if your HTML is this:

<h1 class="hm-text hm-size-30__90">article headline</h1>

Then, this script will find this tag, and periodically replace the innerText of h1 with random strings which are anywhere between the minimum length 30 and maximum length 90. Similiarily, constraints on image sizes, video sizes, # of children elements in a list etc. For a list, mock children elements will be generated

Some examples of the constraints are:

Ideas for more constraints: