Suppose I need to have a text with a bold and an italic part that overlap each other, like you see this sentence have.
Now, I know the proper w
As of HTML5, the procedure for dealing with these "overlapping tags" is standardized: https://html.spec.whatwg.org/multipage/syntax.html#adoption-agency-algorithm
When parsing
I want this text to have both bold and italic
we'll encounter the following step when we get to the tag:
- If formatting element [here, the element started with
] is not the current node [here, the
element], this is a parse error. (But do not abort these steps.)
The specification goes on to close the and
and re-open a new
in this case. So while you do get a "parse error," this markup will still do what you want, according to the standard.
I'll try to stick with objective facts.
This automatic fixup is limited to closing up to 8 levels of formatting tags (see step 3 in the algorithm). Because of that, it's not appropriate as a general technique.
Also, elsewhere in the spec, https://html.spec.whatwg.org/multipage/syntax.html#parse-error
... user agents, while parsing an HTML document, may abort the parser at the first parse error that they encounter for which they do not wish to apply the rules described in this specification.
Browser vendors are free to stop the parser if they don't want to deal with this situation.