-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Gregory Maxwell wrote:
On 8/13/07, Brion Vibber brion@wikimedia.org wrote:
More to the point, that's just wrong -- remove the 'javascript:' from the onclick attribute. :)
Pshaw. It's what I mean not what I say that counts! :)
The practical problems with href="javascript:blah" are:
- The link is 100% useless when JS is disabled
- You can't get anything useful out of an 'open in new window' or other
sort of right-click fun stuff
Right well I left room to fix that in the syntax:
[[javascript:foo|something|http://wikimedia.org/functionally_equal_to_foo.php%7Carg1]] becomes: <a href="http://wikimedia.org/functionally_equal_to_foo.php?arguments=arg1" onclick="MW_UI_event_foo('arg1');return false;">something</a>
Now you nicely fall back to the link if JS is disabled.
Although I would intend and hope that this functionality only be used for things which JustCantWorkWithoutJavaScript(tm), like the clickable/draggable map thing.
Obviously, the proliferation of avoidable JS dependencies is bad and should be avoided.
The part that always seems hard to do right is making things fall back in a clean way when JS is unavailable. Some UI elements just don't have a sensible fallback, so the best thing may be to construct them in JS itself.
I know we have issues with this now with for instance the character buttons in the edittools boxes.
- JavaScript code appears in the browser status bar, which sucks.
Under what conditions? It will appear if you do a href="javascript crud" but I don't think it will if you confine the JS to an onclick.
That's kind of why I said it only applies to href="javascript:crud", dude. :)
Additionally there's the ideological objection: 4) Code is mixed with presentation.
That last one applies to inline definitions of event handlers like onclick="blah()" but isn't _that_ big a deal really.
I would expect the actual use to be abstracted via templates. So the user might say {{location|23|-80}} which does some things and ends up displaying the location along with a link to bring up the map.
Doing this preserves the separation of code and presentation in practice.
*nod*
- -- brion vibber (brion @ wikimedia.org)