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

Arguably:

  PHP is like Javascript but worse.
  Since React, Javascript is like PHP but worse.



document.write called on a loaded document? Reopen it and clear its contents. Yes because that makes sense and I wouldn’t want that to be an error state. Oh JavaScript.

(But also, just don’t use document.write)


What if you actually wanted to replace the entire document contents with a new document? Why should that be an error?

The fact that the meaning of the API is commonly misunderstood is not (necessarily) a fault of the API


Sure, something like a .clear or similar but the default behavior of clearing a loaded document by calling open on it is strange compared to what you would expect to happen with “normal” files/streams.

Edit to add:

I think calling write on a loaded document should have been an exceptional case and you should have had to explicitly call something to unload, replace or clear it.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: