Encapsulate scope of `c` variable
By changing to auto invoking call the `c` variable will be encapsulated in its scope therefore not polluting the global scope and will continue to function as previously. Fixes conflict and reassigning of already used variables when using other minified scripts. In my case the problem occurred with the Speed Booster Pack plugin.
This commit is contained in:
parent
6eb65cb40c
commit
c2ab6a488d
|
@ -348,9 +348,11 @@ function wc_body_class( $classes ) {
|
|||
function wc_no_js() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var c = document.body.className;
|
||||
c = c.replace(/woocommerce-no-js/, 'woocommerce-js');
|
||||
document.body.className = c;
|
||||
(function () {
|
||||
var c = document.body.className;
|
||||
c = c.replace(/woocommerce-no-js/, 'woocommerce-js');
|
||||
document.body.className = c;
|
||||
})()
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue