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.
- 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. It certainly doesn't in the really dumb test case I just created: http://tools.wikimedia.de/~gmaxwell/jstest.html
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.
If we wanted to be especially ideologically pure I suppose we could create something like a MediaWiki:LinkHandlerList which would have items like *[[Special:Mapper/mappopup]] Popupmap(), http://alternative/foo.
Then use it by just adding links of the form [[Special:Mapper/mappopup/argument]], but that seems like needless indirection to me.