This patch removes CSS and JS file info from ajaxPageState
and add them to data-js-files
and data-css-files
attributes on the <script>
, <link>
and <style>
elements. I was able to remove some PHP black magic around settings thanks to that.
This reduce the size of Drupal.setting quite a bit. Everything works the same as before, the file list are fetched from the attributes and sent in the ajax request as usual.
One painful thing was conditional comments. They need to be processed with regexp since they are not in the DOM and can't be accessed with jQuery selectors. The code isn't the prettiest one but it works for now.
Let's see how much it'll break the testbot.
Comment | File | Size | Author |
---|---|---|---|
#13 | core-js-remove-CSS-JS-ajaxPageState-13.patch | 34.13 KB | Jelle_S |
Comments
Comment #2
nod_how many break now?
Comment #3
nod_Comment #5
catchComment #6
martin107 CreditAttribution: martin107 commentedPatch from 2012 needs reroll
Comment #7
sanchiz CreditAttribution: sanchiz commentedInitial re-roll
Comment #9
dankh CreditAttribution: dankh commentedI could apply the patch, so no reroll is needed.
Comment #10
sanchiz CreditAttribution: sanchiz commentedComment #11
Jelle_SI'll have another stab at this.
Comment #12
Jelle_SI've been trying just to get the tests to pass and now my head hurts...
There should be less failures now but it won't be green. I just wanted to upload this patch already so others can continue work on this.
I'll be leaving Amsterdam in an hour or two and I don't think I'll be able to finish this by then, so I'm going to look for an issue I can work on I might be able to complete in time :-)
Comment #13
Jelle_SOne more test that passes *whoop whoop*
Comment #14
sanchiz CreditAttribution: sanchiz commentedComment #17
LewisNymanComment #18
nod_This is rendered obsolete by #2368797: Optimize ajaxPageState to keep Drupal 8 sites fast on high-latency networks, prevent CSS/JS aggregation from taking down sites and use HTTP GET for AJAX requests which makes ajaxPageState of reasonable size. We don't need to do the diff of files to add on the front-end either (which was the idea behind this patch).