-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Gregory Maxwell wrote:
On 8/13/07, Brion Vibber <brion(a)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:
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
Right well I left room to fix that in the syntax:
[[
javascript:foo|something|http://wikimedia.org/functionally_equal_to_foo.php…]]
becomes:
<a
href="http://wikimedia.org/functionally_equal_to_foo.php?arguments=arg…
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.
3) 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)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla -
http://enigmail.mozdev.org
iD8DBQFGwawmwRnhpk1wk44RAtQuAJ4mx0lisywkki6v7H9HxT0uxPptzgCgnix8
pXlvlnbk9StkSCTy8DGLqHs=
=B0Yy
-----END PGP SIGNATURE-----