Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32142
| Path | csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: How bad is my hack? |
| Date | Sun, 08 Jan 2017 23:39:25 +0100 |
| Organization | PointedEars Software (PES) |
| Lines | 43 |
| Message-ID | <5139801.MhkbZ0Pkbq@PointedEars.de> (permalink) |
| References | <hack-20170108182735@ram.dialup.fu-berlin.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | solani.org 1483915167 18741 eJwFwYEBwDAEBMCVIniMg+b3H6F3rhBsGBzmdCpH0URZya2puJIcufkCyKV9gQeerj3ewR8SUBDx (8 Jan 2017 22:39:27 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Sun, 8 Jan 2017 22:39:27 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| Cancel-Lock | sha1:f8Ht9Q2FQ+uVcfLnXDXL4yp4dUM= |
| X-NNTP-Posting-Host | eJwFwYEBgDAIA7CXxmiLnIMI/59gQpepA6LA5U6AuK1ORg5NhYmDd3I5KO+6j52aSHr7fj8TcBEP |
| X-User-ID | eJwNzAEBwDAIAzBLsEE75DD++pfwR0BywzEMJCKVGnULUmtlD8ceYccdMMaOs8vTudSv2VwyrE7xWqysP+AHgrQVmA== |
| X-Face | %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Face | iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== |
| Xref | csiph.com comp.lang.javascript:32142 |
Show key headers only | View raw
Stefan Ram wrote:
> event => alert( event.cancelable, event.preventDefault() )
>
> Explanation: I want to show the value of »event.cancelable«,
> and prevent the default handling for the event, but was too
> lazy to open a block and write
>
> event => { alert( event.cancelable ); event.preventDefault(); }
>
> . Actually, I did not want the line to become too long.
>
> How bad is this hack?
>
> [ ] Why, we all do it this way!
>
> [ ] In the next version of webappapis.html#dom-alert, »alert«
> will get a second parameter, and your code will break!
<diddle>
> [x] The maintenance programmer will not understand your
> intentions.
</diddle>
Also, in some implementations the alert() method *does* have a meaningful
second argument; IIRC it specified the title of the alert window when there
still was one (nowadays, popup messages are more common).
> Well, now that I see the block, I observe that it is not
> that much longer, so I just might change my code to the
> version with the block.
Please do. And always write “window.alert(…)” instead of “alert(…)”.
That said, avoid “…alert(…)” for developers in favor of “console.…(…);”.
“…alert(…)” is a nuisance and can easily get a PITA if used wrong because it
removes the focus from the window.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread
Re: How bad is my hack? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-08 23:39 +0100
csiph-web