Simetrical wrote:
On 8/13/07, Gregory Maxwell gmaxwell@gmail.com wrote:
Bringing this back on topic, Does anyone see a reason why it would be unreasonable to add a feature to mediawiki which would enable something like:
[[javascript:foo|something||arg1]] which gets converted to <a href="#" onclick="javascript:MW_UI_event_foo('arg1');;return false;">something</a>.
(and ditto for clickable image maps).
Right now tools like the popup media player and wikiminiatlas scan all anchor tags on load in order to add startup hooks, this causes a fair bit of wasted effort.
JavaScript URLs are usually viewed as a Bad Thing. Is there a demonstrable performance problem with adding the hooks dynamically?
More to the point, that's just wrong -- remove the 'javascript:' from the onclick attribute. :)
The practical problems with href="javascript:blah" are: 1) The link is 100% useless when JS is disabled 2) You can't get anything useful out of an 'open in new window' or other sort of right-click fun stuff 3) JavaScript code appears in the browser status bar, which sucks.
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.
-- brion vibber (brion @ wikimedia.org)