I posted another question on a very similar topic, but turned out to be a little subjective. I am able to divided the question in two questions, one that I will explain below:
In the following Code:
<script type="text/javascript">
$(function()
{
$("#accordion").accordion();
$("#datepicker").datepicker();
$("#button").click(function()
{
runEffect();
return false;
});
});
</script>
Question: If I have this code called in a 1,000 pages, but only 250 pages have a datepicker id. Will the browser spend extra time on the other 750 pages trying to parse for id datepicker, or Jquery has a smart way of solving this situation without affecting performance?
What happen if the code is making reference to ids or classes that does not exist on the html markup of the current page, will that impact performance?