Actually there is one potentially huge use case for this: user-submitted posts with HTML formatting. Loads of blogs, forums, and comment sections support some kind of de-facto standard BBcode for basic markup, such as by using [b]bold[/b] and [i]italic[/i], or markdown like **bold** *italic*. These force web developers to re-invent subsets of HTML for security reasons. Using unfiltered HTML itself is incredibly dangerous due to users being able to post arbitrary <script> tags, and even filtering HTML is incredibly difficult given the number of places Javascript can be included in HTML combined with encoding variations, such as <img src=jAvascript:alert('my js')>.
Something like a <sandbox> tag could solve this. An iframe is probably overkill for including user-submitted content, but a tag could provide similar protections for the content inside of it. Like with the iframe sandbox attribute, by default markup inside <sandbox> would:
- not allow script execution in any way
- not allow forms
- not allow plugins
The restrictions should probably go beyond iframe sandboxing to also:
- not allow custom CSS styles
- block potentially dangerous tags like
<iframe>
- block potentially annoying tags like
<video>, <audio>
- block tags that become useless under the above restrictions, like
<canvas>, <dialog>, form controls
Like iframe sandboxing the restrictions could be customised with attributes, such as <sandbox allow="video"> in case a forum wants to allow videos to be included in posts.
Ideally the end result is web developers can ultimately paste user-submitted HTML between <sandbox> and </sandbox> and still have a secure website, without having to use a custom markup engine.