As to "why" it was implemented this way, there's probably no answer from the outside. A good example is when former IE developer, the inventor of innerHTML, faces problems with innerHTML itself.
Asking why is also unnecessary because
Another thing to note is that your analogy is too specific. The issue is not restricted to the assignment expression
, you can reproduce it with other types of expressions
:
undefined === elem.onclick( true )
typeof elem.onclick( true )
elem.onclick( true ) - 1
alert(elem.onclick( true ))