I know that it\'s faster to do the following:
var $header = $(\"#header\");
$header.css({color:\"#ff0000\"});
$header.find(\"a\").addClass(\"foo\");
<
I found the solutions a few minutes after posting this. For those who are wondering, here it is:
$.merge($header_elements, $footer_elements).css({color:"#ff0000"});
Is it faster? I don't know yet, I'll need to run some tests to find out.
EDIT:
I tested it with JS Fiddle here : http://jsfiddle.net/bgLfz/1/
I tested using selector each time, variable for both selector, variables with $.merge() and using .add(). Each test was run 1000 times.
Results on my side are as follow (from faster to slower):