Closed wvega closed 8 years ago
Just to be sure: This still removes plain <script>
tags without a type
attribute, right?
Yes, every script where the type
attribute is not present, has an empty value, or defined with one of text/javascript
, text/ecmascript
, application/javascript
, application/ecmascript
, text/x-javascript
or text/x-ecmascript
as value, will be removed.
Sounds great, thank you! :beers:
Thank you for your quick response and merging this so fast!
Hello,
We've just discovered a problem with one of our WordPress themes that uses theia library: our users use the custom HTML widget to insert MailChimp popup script (provided by MailChimp), and the popup doesn't show.
Just a question: why do you remove inline script
like this? Scripts are still helpful in many situations like above.
Hi, because in most cases you don't have a <div class="theiaStickySidebar">
container, so a new one is created and the HTML is moved around, causing the inline script tags to fire twice unless we remove them.
If the class exists, does the library remove the scripts?
We need to keep the scripts in the sidebar. The problem with current version is if the script is an external script (with src
attribute), then there might be a situation that the script has not loaded yet before Theia removes it, making it doesn't execute at all.
Sometimes script tags can be used to store templates instead of executable code (See KnockoutJS template binding for an example). Removing those scripts can cause other features to break.
This PR modifies the plugin to only remove script tags with an empty type or one that matches a JavaScript MIME type.