Riot DOM Caveats

Riot components rely on browsers rendering so you must be aware of certain situations where your components might not render properly their template.

Consider the following tag:

  1. <my-fancy-options>
  2. <option>foo</option>
  3. <option>bar</option>
  4. </my-fancy-options>

This markup is not valid if not injected in a <select> tag:

  1. <!-- not valid, a select tag allows only <option> children -->
  2. <select>
  3. <my-fancy-options />
  4. </select>
  5. <!-- valid because we will render the <option> tags using <select> as root node -->
  6. <select is="my-fancy-options"></select>

Tags like table, select, svg… don’t allow custom children tags so the use of custom riot tags is forbidden. Use is instead like demonstrated above. more info