Skip to main content
Code Review

Return to Revisions

2 of 2
replaced http://stackoverflow.com/ with https://stackoverflow.com/

##Naming##

Using single-letter variable names is bad, and there is absolutely no reason to use them as we aren't limited on name length anymore. Looking through your code, I still don't know what a, b, i, j, m, and the like mean, what they are, or what they do. Using descriptive names would tell me what they do so I could understand the code even if I didn't know JavaScript. Also, if you use good names, you won't need to give a comment stating what the variable is, does, or contains. Good code doesn't need a whole lot of comments. In fact, most of the comments I see are like this:

catch
{
 // gotcha!
}

##Sorting##

var l = [ a[j].id, b[k].id ].smartSort('a');
var f = [ a.tagName, b.tagName ].smartSort('d');

I assume 'a' and 'd' are specifying which way to sort the collection of items. You should avoid passing text values to specify what your program should do. In this case, I would pass a Boolean value, but you can define enums in JavaScript too.

##Functions##

You don't need to all related code in one function. You should split your code up into more functions. This also makes it easier to pinpoint bugs, fix them without introducing more bugs, and helps prevent violation of SRP and creation of megamoths.

user34073
default

AltStyle によって変換されたページ (->オリジナル) /