Currently, a single file can be added twice when it’s in different theme layers. For example, if you require jQuery for your theme, you typically add drupal_add_js('misc/jquery.js', 'theme');. If jQuery is already present in the core layer, it’s added again because the file check is restricted to the layer.

Comments

morbus iff’s picture

Something to consider would be if a duplicate file is found, do we a) ignore the second request, b) find out which request is lower or higher and logically choose the Right One. Would there ever be a situation where a file is added to 'core', then added again in 'theme', and having it lower (in 'theme') is The Right and Desired Way? With the "ignore the second request" possibility, we'd seemingly only care about 'core' if it was ever added first... would there ever be a use case where we want a lower scope to prevail should duplicates exist?

kkaefer’s picture

Status: Active » Closed (won't fix)

I'm marking this as won't fix because I haven't got any report on that flaw actually causing problems. It probably won't happen that a single JS file is put into two different scopes and/or types.

pingers’s picture

We're having the exact same trouble where in conjunction with panels we're including js twice... it's very annoying and I'm thinking a drupal_add_js_once would be very nice right now.