Code: Select all
var $phpBB = jQuery;
Just tossing stuff out there Igor.
Code: Select all
var $phpBB = jQuery;
Code: Select all
(function($) {
// ... our code
})(jQuery);
Code: Select all
$('a.open').show('#MyDiv');
$('a.close').hide('#MyDiv');
Code: Select all
var targetDiv = $('#MyDiv');
$('a.open').show(targetDiv);
$('a.close').hide(targetDiv);
Code: Select all
$('#MyDiv').show();
$('#MyDiv').html('hello world');
Code: Select all
$('#MyDiv').show().html('hello world');
Code: Select all
$('#MyDiv').show().html('hello world');
Code: Select all
$('#MyDiv').show('fast',function(){$(this).html('hello world');});
Well, CSS is matched from right to left, so some of those may even be slower in some cases.VSE+ wrote:Selecting by classes is much slower than by IDs or even by html tags.
I'd rather encapsulate in a closure than writing jQuery all over the place.nn- wrote:In the meantime I think we should spell out jQuery() instead of $().
Any specific benefits except that it's more descriptive? People may want to switch it out to non-minified for dev purposes.Consider using jquery-min.js for the minified version.
Will analyze this, but it's being cached, so probably not all that bad. And it adds a burden to MOD authors, so needs to be carefully considered I suppose.I don't very much like the idea of including jquery on every page. The pages that need it should indicate so using some method, and it should only be included if it is needed. Unless over, say, 2/3 of the pages need it.
I'm not very familiar with the API history of jQuery. But I believe there have been hardly any API breakages so far. Thus, I would suggest sticking with the latest 1.x. I'm not really a fan of having the version in the file name, because it means you have to change it in several places when a new version comes out.Which versions of jquery is our code compatible with? If there is a security release in 1.5.x branch can we update? If there is an unfixed security issue in 1.5 can we update to 1.6? 2.0? Consider including a prefix of version number into jquery(-min).js file name to indicate the acceptable update versions.
Yes, paul already suggested that and it's a good idea.An idea from the template engine pull request: if dE() is desired, put it into a compat.js file that modifications can request.
As I understand it, which may be totally incorrect, in this wayigorw wrote:@RMcGirr83 mind to explain? What's the difference / benefit?
Code: Select all
$('#MyDiv').show().html('hello world')
Code: Select all
$('#MyDiv').show('fast',function(){$(this).html('hello world');});
Jeez Louise, I was just trying to show an example of chaining to avoid multiple selector calls... You didn't have to jQuery police meRMcGirr83 wrote:As I understand it, which may be totally incorrect, in this wayigorw wrote:@RMcGirr83 mind to explain? What's the difference / benefit?
show will happen, then .html for "hello world"Code: Select all
$('#MyDiv').show().html('hello world')
in this way
html happens prior to show occurring.Code: Select all
$('#MyDiv').show('fast',function(){$(this).html('hello world');});
As I said that is the way I understand it which may, or may not, be correct and it may be minutia anyway. Being a Dev the choice is, ultimately, yours.