3 ms·
Error is still there, it is just a non breaking error. Imagine Word or Excel document that's trying to silently recover. I do not see programming languages ado
by sergeykish 6y ago
Error is still there, it is just a non breaking error.
Imagine Word or Excel document that's trying to silently recover. I do not see programming languages adopting "not to fail" approach
1 + "2"
//"12"
1 - "2"
-1
There were PHP sites with mysql connection error all around. As industry we've chosen AirBrake approach — fail and notify developers. HTML makes it easier to edit plain text but there is a price. What you load is not what you've stored, HTML is a lossy serialization [1] [2] [3].
Program not human produced DOM, it should be safe to serialize-deserialize. It could be JSON, XML, s-expressions. It is unsafe with HTML.
It is very easy to author XHTML. Start DOM first (HTML for brevity):
data:text/html;charset=UTF-8,<p contenteditable>foo
Done, it automatically escapes <>&. Extend with some controls [4], store it as XHTML [5]. It is WYSIWYG, much easier than HTML authoring.
[1] http://sergeykish.com/script-style-is-cdata-in-html http://sergeykish.com/script-style-is-cdata-in-html
[2] http://sergeykish.com/content-after-html-appended-to-body-in-html http://sergeykish.com/content-after-html-appended-to-body-in...
[3] http://sergeykish.com/pre-newline-ignored-in-html-test http://sergeykish.com/pre-newline-ignored-in-html-test
[4] http://sergeykish.com/live-pages http://sergeykish.com/live-pages
[5] http://sergeykish.com/bookmarklet-put-xhtml http://sergeykish.com/bookmarklet-put-xhtml
- barrkel 6y agoHTML mostly ends up rendering text and images, and you have to mess up really hard to lose both of those. Typically what breaks is styling. It might not be pretty, but it may still be functional.
- sergeykish 6y agoI can't mess it when I edit DOM and browser restores it as it was. I may have <ul> in <p> (we had it in 1978), I may have <a> in <script> (and it works like comment), I may have <pre>\n and don't worry that it disappear each time I save document. I may have nested <script type="foo"> tags [1]. DOM supports it. XHTML supports it. HTML breaks my content on save-load. [1] https://stackoverflow.com/a/59548670/5554075 https://stackoverflow.com/a/59548670/5554075