Open benlk opened 5 years ago
This line of code:
https://github.com/INN/doubleclick-for-wp/blob/bf4fcb5423ff359af955948ba253a8e2211185a3/inc/class-doubleclick.php#L210-L212
Can potentially be output upon the page before the script enqueues that load the js:
https://github.com/INN/doubleclick-for-wp/blob/bf4fcb5423ff359af955948ba253a8e2211185a3/inc/class-doubleclick.php#L180-L181
On one site in recent memory, the normal code output on the page was thus:
<script type='text/javascript' src='https://example.org/wp-content/plugins/doubleclick-for-wp/js/vendor/jquery.dfp.js/jquery.dfp.min.js?ver=0.3.0'></script> <script type='text/javascript'> /* <![CDATA[ */ var dfw = { /* snip */}; /* ]]> */ </script> <script type='text/javascript' src='https://example.org/wp-content/plugins/doubleclick-for-wp/js/jquery.dfw.js?ver=0.3.0'></script> <script type="text/javascript"> jQuery('.dfw-unit:not(.dfw-lazy-load)').dfp( window.dfw ); </script>
but when that site loaded the https://wordpress.org/plugins/autoptimize/ plugin, the call to jQuery().dfp(); came before the concatenated scripts were loaded on the page.
jQuery().dfp();
Problem
This line of code:
https://github.com/INN/doubleclick-for-wp/blob/bf4fcb5423ff359af955948ba253a8e2211185a3/inc/class-doubleclick.php#L210-L212
Can potentially be output upon the page before the script enqueues that load the js:
https://github.com/INN/doubleclick-for-wp/blob/bf4fcb5423ff359af955948ba253a8e2211185a3/inc/class-doubleclick.php#L180-L181
On one site in recent memory, the normal code output on the page was thus:
but when that site loaded the https://wordpress.org/plugins/autoptimize/ plugin, the call to
jQuery().dfp();
came before the concatenated scripts were loaded on the page.Solution