new XMLSerializer().serializeToString(new DOMParser().parseFromString("<a>hello < </a>", "text/html"))
The above in my console does as expected there. And again, entities are a very dangerous part of XML and friends.You are correct that if you tell it that that is xml, the browser will throw it back at you. Just as the JSON parser will barf on JSON.parse("{'test':'value'}").
any parser that behaves otherwise is pretty clearly buggy
json has many problems but parsing ambiguity is not really one of them
json is not
show me an application that parses `{'a':'b'}` as valid JSON, i'm actually interested, probably there are some which exist, but there is no ambiguity about those applications being wrong
afaict none of them permit keys or value strings to be expressed with single quotes
I did find https://github.com/json5/json5 no a quick search that basically says what I asserted about people just jumping to another standard for things that you hand write. I was probably also thinking heavily about python's dict syntax. (And I confess, I still don't know when to use single versus double quotes in python...)
html is not precisely defined
HTML5 is not XHTML.
<!DOCTYPE html> <title>Title <h1>Heading
expands to
<!DOCTYPE html> <head><title>Title</title></head> <body><h1>Heading</h1></body>