I tried both your examples and $(‘a:not(.ui-accordion-header a)’).
They all work fine according to fire-bug, but in reality they do not work:
The debugger indicates that this statement only executes for links that are not in .ui-accordion-header - which is exactly right.
But still the loading.gif also appears when clicking on the link in .ui-accordion-header - even though the statement’s breakpoint did not cause fire-bug to halt (statement was not executed by fire-bug).
If I comment out the statement, then no loading.gif appears for all links. So there is no other statement somewhere else causing this behaviour.
The only guess that I would have as to why it works correctly after page load (i.e. in the debugger) but not normally is that the UI styles have not yet been applied to the elements when you are calling the selector.
However, I abandoned this mission, since my statement simply selects too much other unwanted links on the page as well. So I was forced to be more precise and had to rather stipulate the individual links I wanted to be selected. I gave them all a separate css class.