Closed (fixed)
Project:
Visual Website Optimizer
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Dec 2020 at 22:16 UTC
Updated:
11 Jun 2024 at 05:38 UTC
Jump to comment: Most recent
Comments
Comment #3
elc commentedNeeds review by an active user of the module to confirm this does not adversely effect anything. It should effectively be a transparent change. Including in had is also one of the specifications for adding VWO code.
I would expect this should be an included change.
One possible issue would be access to the drupal settings since these are usually included later in the page. Although this may be why #3184848: Fix broken drupalSettings is also needed.
The JS was originally included in the head by using an inline js include but this is not available in D8 yet as per #2391025: Add support for inline JS/CSS with #attached. The use of a library was included later on.
Comment #4
elc commentedAfter reading up on drupal behaviours as in #3184848: Fix broken drupalSettings in combination with this change, I'm concerned that neither of them should be included.
This patch is adding the VWO code to the head instead of the footer. It still needs variables from settings which appear to be only available in footer.
The 3184848 patch then converts the existing JS into a behaviour which are then only run at the end of the page load.
These changes together appear to make zero different to the functionality of the module or when the JS is run. It still runs at the end of the DOM fully loading. What is needed to make it run early is inline js include, which is still an outstanding issue on core.
Could anyone please confirm this is what is happening?
Comment #5
elc commentedContrib module to add inline js in head.
https://www.drupal.org/project/attachinline
- test this works
- make this a dependency
- move all variables and content back into inline, removing settings array/behaviour
This core issue should be marked as closed: #2391025: Add support for inline JS/CSS with #attached
Comment #6
elc commentedChange to issue status.
Comment #8
elc commentedAvailable in dev package, or next release as 8.x-1.3, perhaps as RC1.