Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298337

JS aggregation should account for "defer" and "async" attributes

$
0
0

Problem/Motivation

HTML5 proposes/solidifies asynchronous loading of JavaScript files based on two attributes: defer and async. Drupal has supported defer since at least D6, and support for async is currently in the works (#1140356: Add async, onload property to script tags).

Current behavior is that once you turn JS aggregation on, adding a defer or async property to your drupal_add_js call almost definitely results in the script being bundled into an aggregate without the property set. As a result, code you were expecting to fire asynchronously is now blocking. As such, we should be aggregating async and defer scripts into their own bundles.

Proposed resolution

Presumably, something will be added to drupal_group_js that groups "async" values with one another and "defer" values with one another, respecting their weights.

Remaining tasks

User interface changes

None

API changes

Though this affects JavaScript aggregation, this should have little-to-no API impact.


Viewing all articles
Browse latest Browse all 298337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>