document-policy icon indicating copy to clipboard operation
document-policy copied to clipboard

Feature Request: policy for well formed DOM

Open Jamesernator opened this issue 7 years ago • 1 comments

Currently DOM permits a lot of trees that couldn't be represented in HTML or are semantically invalid.

For example this tree couldn't be represented in HTML but can be constructed in DOM anyway:

p
  "Some text"
  p "Another paragraph nested inside"
  "More text"

Another example is this tree that can be represented in HTML but could break accessibility:

p "Some text"
li "An out of place list item"
p "Some more text"

I propose a feature policy well-formed-dom that fails to construct DOM if it would break the content model specified by HTML.

Jamesernator avatar Sep 10 '18 06:09 Jamesernator

FWIW, while I appreciate the sentiment, I don't think this is doable. This would add massive complexity and doesn't really buy us much. It would mostly lead to slower code.

annevk avatar Nov 14 '18 13:11 annevk