A lot of core JavaScript files not being included For some reason a bunch of core JS files are not being loaded. I've had to manually add them in with a module hook_js_alter function like so:

function MYMODULE_js_alter(&amp;$js) {
    drupal_add_js('misc/jquery.js', array('group' =&gt; JS_LIBRARY, 'weight' =&gt; -100, 'every_page' =&gt; TRUE, 'scope' =&gt; 'header'));
    drupal_add_js('misc/jquery.once.js', array('group' =&gt; JS_LIBRARY, 'weight' =&gt; -99, 'every_page' =&gt; TRUE, 'scope' =&gt; 'header'));
    drupal_add_js('misc/jquery.cookie.js', array('group' =&gt; JS_LIBRARY, 'weight' =&gt; -98, 'every_page' =&gt; TRUE, 'scope' =&gt; 'header'));
    drupal_add_js('misc/form.js', array('weight' =&gt; 19, 'every_page' =&gt; TRUE, 'scope' =&gt; 'header'));
    drupal_add_js('misc/collapse.js', array('weight' =&gt; 20, 'every_page' =&gt; TRUE, 'scope' =&gt; 'header'));
}


The only core JS file loading by itself is drupal.js, and a bunch of module scripts. Other than that I had to include the 5 above myself, otherwise various parts of the public site and admin areas were not working. 

This works, but it feels really sketchy. And previously I had only included the first 3, until I noticed more admin form stuff breaking. So I hate to think that there may be MORE scripts that I will only discover missing through trial and error.

Any ideas why they are not being included?? 

UPDATE

I've narrowed it down, there are two custom modules which are breaking it. One of them is much simpler than the other so I'll just try to figure that one out first. This line of code, inside the .module file, and not within any function, is causing the issue ($form_js is a string containing JavaScript)

drupal_add_js($form_js, array('type' =&gt; 'inline', 'scope' =&gt; 'footer'));
I figured out that using drupal_add_js outside of a hook_js_alter function in another file was causing the issue.

drupal_add_js($form_js, array('type' =&gt; 'inline', 'scope' =&gt; 'footer'));


Now that it is within the function, it's working fine.

I don't see anything in the documentation saying that this is required -> also, drupal_add_css works fine outside of a function. I'm not altering any existing JS files, only adding new ones.

So while I don't understand why this is an issue, this is the solution