User:CodeCat/lookup language

Fragment of a discussion from User talk:Rua

You want to use jQuery — fine. Just use it sensibly. Building DOM is actually more direct — HTML has to be parsed, and parsing is costly. DOM nodes can be put into variables to be later used directly (instead of going through a jQuery wrapper object, often completely unnecessary), like I showed; putting everything into one long string and later plucking out interesting fragments complicates things. Also, carelessly manipulating the markup instead of DOM can lead to problems, like it did at MediaWiki:Gadget-FastRevert.js.

Time to start building a library, it seems. Rather easy to start: just create a gadget in MediaWiki:Gadgets-definition, and set the |skins=none option to hide it from Special:Preferences. Then use it just like you did with LegacyScripts.

About the fifth point, I was referring to the comma, not the apostrophes. (Quoting keys is actually necessary for compatibility.)

Keφr18:35, 24 August 2014

What would I use instead of the comma then?

CodeCat18:53, 24 August 2014

Nothing? Comma is a separator, not a terminator.

Keφr19:49, 24 August 2014

Oh I see now. Some languages allow a comma at the end of the list, I know both Python and Lua do. Since I prefer to place the actual terminator of the list on the next line by itself, putting a comma after the last element looks a bit more consistent. It's more a matter of code style than it really being useful for anything. If not all browsers support it I won't do it for JS.

CodeCat19:54, 24 August 2014