laracasts / PHP-Vars-To-Js-Transformer

Transform PHP data to JavaScript.
https://packagist.org/packages/laracasts/utilities
MIT License
2.21k stars 219 forks source link

echo before view breaks DOCTYPE sniffing #136

Closed maxim-devereaux closed 2 years ago

maxim-devereaux commented 3 years ago

Experienced upgrading to TinyMCE 5 with Laravel 5.7 and Laracasts\Utilities.

TinyMCE used in views along with Laracasts\Utilities\Javascript will not initialize. Error states that the document is not in standards mode.

This is due to Laracasts\Utilities\Javascript causing the document source to appear as follows:

Thus DOCTYPE is not specified first in the document. Nasty hack fix, replace echo in LaravelViewBinder with: echo "\n\n"; to add an additional DOCTYPE at the start of the document But can we do better?
maxim-devereaux commented 2 years ago

Just adding a partial (as is recommended) and binding to this, rather than binding to the main template, solves this.