Active
Project:
Apache Solr AJAX
Version:
6.x-1.11
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Nov 2011 at 06:16 UTC
Updated:
29 Nov 2011 at 06:16 UTC
I think a little bit of optimization can be done in the code of apachesolr_ajax.js. The following code block (line 56 - 61):
for (var block in data.regions[region]) {
if (regions[region] && blocks[block]) {
var elements = $(data.regions[region][block]);
Drupal.attachBehaviors(elements.appendTo(regions[region]));
}
}
Can be replaced by:
if (regions[region]) {
for (var block in data.regions[region]) {
if (blocks[block]) {
var elements = $(data.regions[region][block]);
Drupal.attachBehaviors(elements.appendTo(regions[region]));
}
}
}
So, if the condition (regions[region]) if false, the loop will not execute.
I have attached the updated code.