On Mon, Aug 17, 2009 at 12:30 PM, Roan Kattouwroan.kattouw@gmail.com wrote:
Both the usabilty and new upload JS use jQuery, which hides most browser sniffing you need in abstraction layers. To my knowledge the jQuery devs do sniff browsers properly, and if something should go wrong in jQuery, it's not just Wikipedia that'll break.
This doesn't look like doing things properly to me:
js/js2/jquery-ui-1.7.2.js- // Prevent text selection in IE js/js2/jquery-ui-1.7.2.js: if ($.browser.msie) { js/js2/jquery-ui-1.7.2.js- this._mouseUnselectable = this.element.attr('unselectable'); js/js2/jquery-ui-1.7.2.js- this.element.attr('unselectable', 'on'); js/js2/jquery-ui-1.7.2.js- }
js/js2/jquery-ui-1.7.2.js- // preventDefault() is used to prevent the selection of text here - js/js2/jquery-ui-1.7.2.js- // however, in Safari, this causes select boxes not to be selectable js/js2/jquery-ui-1.7.2.js- // anymore, so this fix is needed js/js2/jquery-ui-1.7.2.js: ($.browser.safari || event.preventDefault());
js/js2/jquery-ui-1.7.2.js- return { js/js2/jquery-ui-1.7.2.js- top: ( js/js2/jquery-ui-1.7.2.js- pos.top // The absolute mouse position js/js2/jquery-ui-1.7.2.js- + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent js/js2/jquery-ui-1.7.2.js- + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) js/js2/jquery-ui-1.7.2.js: - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) js/js2/jquery-ui-1.7.2.js- ), js/js2/jquery-ui-1.7.2.js- left: ( js/js2/jquery-ui-1.7.2.js- pos.left // The absolute mouse position js/js2/jquery-ui-1.7.2.js- + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent js/js2/jquery-ui-1.7.2.js- + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) js/js2/jquery-ui-1.7.2.js: - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) js/js2/jquery-ui-1.7.2.js- ) js/js2/jquery-ui-1.7.2.js- }; js/js2/jquery-ui-1.7.2.js- js/js2/jquery-ui-1.7.2.js- },
js/js2/jquery-ui-1.7.2.js- //Opera fix for relative positioning js/js2/jquery-ui-1.7.2.js: if (/relative/.test(this.element.css('position')) && $.browser.opera) js/js2/jquery-ui-1.7.2.js- this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
js/js2/jquery-ui-1.7.2.js- // Prevent IE from keeping other link focussed when using the back button js/js2/jquery-ui-1.7.2.js- // and remove dotted border from clicked link. This is controlled via CSS js/js2/jquery-ui-1.7.2.js- // in modern browsers; blur() removes focus from address bar in Firefox js/js2/jquery-ui-1.7.2.js- // which can become a usability and annoying problem with tabs('rotate'). js/js2/jquery-ui-1.7.2.js: if ($.browser.msie) { js/js2/jquery-ui-1.7.2.js- this.blur(); js/js2/jquery-ui-1.7.2.js- }
etc. There are lots more like that. And that's only one file, and only the ones that looked like they were clearly wrong. It seems to be part of jQuery itself and not our code, but there are examples from our code too. Like r55269, which I've already commented on. (Although it apparently was already scapped less than two hours after it was committed, before I or probably almost anyone else had a chance to look at it, when we have thousands of commits dating back more than two months that are still not live?)
We have some things in core as well, like this in wikibits.js:
if (is_gecko) { // Mozilla needs to wait until after load, otherwise the window doesn't scroll addOnloadHook(function () { if (window.location.hash == "") window.location.hash = fragment; }); } else {
Is this necessary for recent FF versions? I don't know. From looking at it, it will degrade the user experience, causing a jump possibly even after the user has already started scrolling.