I am writing a js file that has a lot of jquery commands within the doc-ready part and then a whole swath of functions following it that are referenced in the jquery commands. Here's a short example,
//jquery on ready
$(function() {
//misc jquery commands
$('#bzm a').click(function(event) {
event.preventDefault();
});
$('.editable').not('video, img, textarea').click(function(event) {
event.stopPropagation();
loadEditor($(this));
return false;
});
});
//bunch of named functions referenced by jquery commands
function loadEditor(node, link){
event.stopPropagation();
var value = node.text();
if (editObj){
commitEditor(editObj);
}
if (node.not('video, img, textarea')){
$('#textEdit')
.copyCSS(node)
.offset(node.offset())
.css('display', 'block')
.val(node.text());
node.css('color', 'transparent');
}
if(node.is('a') || node.parent().is('a') ){
$('#urlEdit').show();
$('#urlEdit').val(node.attr('href'));
} else {$('#urlEdit').hide();}
editObj = node;
if (link){
$('#urlEdit').select();
}else{
$('#textEdit').select();
}
}
I feel like I've seen it said that named functions will cause poor performance in js or something like that.. the closest example I can find is here. I'd just like to know for certain.