I often see string concatenation inside jQuery selectors:
var $field = $('.' + field, $form);
var $label = $('label[for="' + $field.attr('id') + '"]');
var $elem = $('#' + elem);
Since periods and colons are valid in element ids (and who knows what might be in other attributes), is code like this not potentially dangerous?
I have found that some selectors aren't trivial to write in any other way - so what is the standard practice? Native DOM methods are not always available.
I have always avoided weird characters in ids and the like, but when writing tools for general use by others it would be nice to avoid that caveat.