Where in the CiviCRM codebase do css and js resources get output for an AJAX url or snippet?
I haven't found the answer to this question, but I can avoid it instead.

These functions:

CRM_Core_Resources::singleton()-&gt;addScriptUrl()
CRM_Core_Resources::singleton()-&gt;addScriptFile()
CRM_Core_Resources::singleton()-&gt;addStyleFile()


all generate html that gets stored for later output, which is smart most of the time, so it can do some more processing (e.g. weeding out duplicates and/or compressing, whatever).

But if you look in the CRM_Core_Resources object, you can instead use the internal functions to generate the html and then manually add it to the html region that's going to get output in the ajax call.

Here's a patch that solved this for me, as an example.

https://github.com/iATSPayments/com.iatspayments.civicrm/commit/6441cd5dee2ee0163330cceb95b0ce4e3ae37fa8

Just adding js to the html being loaded doesn't always fire the functions that might get fired it was loaded with the original page, so you do have to pay attention to that.