Hacker News new | past | comments | ask | show | jobs | submit login

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

[2] http://sergeykish.com/content-after-html-appended-to-body-in...

[3] http://sergeykish.com/pre-newline-ignored-in-html-test

[4] http://sergeykish.com/live-pages

[5] http://sergeykish.com/bookmarklet-put-xhtml




HTML 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.


I 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




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: