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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, core-js-remove-CSS-JS-ajaxPageState.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
FileSize
15.4 KB

how many break now?

nod_’s picture

Title: Use data- for CSS and JS files list » Use data-* for CSS and JS files list

Status: Needs review » Needs work

The last submitted patch, core-js-remove-CSS-JS-ajaxPageState-2.patch, failed testing.

catch’s picture

Category: Feature request » Task
Priority: Normal » Major
Issue summary: View changes
martin107’s picture

Issue tags: +Needs reroll

Patch from 2012 needs reroll

sanchiz’s picture

Status: Needs work » Needs review
FileSize
14.23 KB

Initial re-roll

Status: Needs review » Needs work

The last submitted patch, 7: core-js-remove-CSS-JS-ajaxPageState-7.patch, failed testing.

dankh’s picture

Issue tags: -Needs reroll

I could apply the patch, so no reroll is needed.

sanchiz’s picture

Issue tags: +Amsterdam2014
Jelle_S’s picture

Assigned: Unassigned » Jelle_S

I'll have another stab at this.

Jelle_S’s picture

Assigned: Jelle_S » Unassigned
Status: Needs work » Needs review
FileSize
33.9 KB

I'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 :-)

Jelle_S’s picture

FileSize
34.13 KB

One more test that passes *whoop whoop*

sanchiz’s picture

Assigned: Unassigned » sanchiz

The last submitted patch, 12: core-js-remove-CSS-JS-ajaxPageState-12.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 13: core-js-remove-CSS-JS-ajaxPageState-13.patch, failed testing.

LewisNyman’s picture

nod_’s picture

Status: Needs work » Closed (won't fix)

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).