This is a "whitelist" model, that denies everything that is not specifically allowed.Given the way browsers parse HTML, each of the different types of slots has slightly different security rules.
This document sets out the most common types of slots and the rules for putting untrusted data into them safely.
Based on the various specifications, known XSS vectors, and a great deal of manual testing with all the popular browsers, we have determined that the rule proposed here are safe.
The slots are defined and a few examples of each are provided.
Developers SHOULD NOT put data into any other slots without a very careful analysis to ensure that what they are doing is safe.
The easiest and safest way to check whether an email address is well-formed is to use PHP's filter_var() function.
This article treats an HTML page like a template, with slots where a developer is allowed to put untrusted data.
These slots cover the vast majority of the common places where a developer might want to put untrusted data.
Putting untrusted data in other places in the HTML is not allowed.
Browser parsing is extremely tricky and many innocuous looking characters can be significant in the right context.