User "Krinkle" posted a comment on MediaWiki.r87845.
Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87845#c16777
Commit summary:
Convert OpenID extension to use ResourceLoader, remove extra copy of jquery
* uses the stock system jquery & jquery.cookie
* uses RL for minification
* uses RL's data URI embedding instead of sprite image for icons
Comment:
<pre>
+var openid = window.openid = {
</pre>
Doesn't have to be local and global. Only window will do, however, see next
point, probably only locally needed.
<pre>
update : function(){
+ event.preventDefault();
</pre>
This doesn't work (atleast not reliably). Let's see where it's bound:
''./SpecialOpenIDLogin.body.php'''<br />
<pre>
Xml::openElement( 'form', array( 'id' => 'openid_form',
'action' => $this->getTitle()->getLocalUrl(), 'method' => 'post', 'onsubmit' =>
'openid.update()' ) ) .
</pre>
I guess the reason you made it global is because it's referenced here and
ResourceLoader executes in local scope, so the 'var' statement no longer is an
implied global.
preventDefault() is not supported on all browsers that we need to support. Also
'event' doesn't exist like that reliably either (sometimes under a different
name, in some browsers it's 'e' rather than 'event'). jQuery solves this by
passing a modified version of the event objet as a first argument to the
callback function. This modified object always has a preventDefault() method
which will trigger the native method if available, and otherwise does an
emulation of it. (see also [http://api.jquery.com/category/events/event-object/
jQuery.Event]).
This is probably fixed easiest by:
# Giving the bind-hungry elements an id or classname (if not already) and
remove the on.... attribute
# Binding them through jQuery instead
# adding 'event' in the argument of openid.update()
# Celebrate that we don't need a global openid-object and that
event.preventDefault() works everywhere :)
_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview