Indeed.
Moreover, aside from the performance and security, there's another important 
factor to take into account. And that is the fact that IDs can contain 
characters that have special meaning in CSS selectors (such as dots).

We've seen this in before when dealing with a MediaWiki heading (where the 
ID-version of the heading can (or could) contain dots). So whenever you have 
what is supposed to be an element ID in a variable, use document.getElementById 
(even if you don't care about performance or security).

Modern browsers like Chrome / IE9 are really fast, jQuery isn't just about performance 
but also about shorter code. Why don't have something like $.id(myId), as a 
"shortcut" to document.getElementById(). Also perhaps another .get* methods 
(there were bunch of them).
As you are one of jQuery code maintainers, such feature can be easily 
implemented.
Dmitriy

_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to