Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: bug with ejs template engine #162

Closed
sintret opened this issue Jul 29, 2023 · 1 comment
Closed

[Bug]: bug with ejs template engine #162

sintret opened this issue Jul 29, 2023 · 1 comment

Comments

@sintret
Copy link

sintret commented Jul 29, 2023

What happened?

i have a code in ejs template like following

<script>
    submitForm('form-group', '', '/<%- routeName %>');
    $(window).keydown(function(event){
        if((event.keyCode == 13)) {
            var eltarget = $(event.target);
            if(eltarget.attr("type") == "input") {
                event.preventDefault();
                return false;
            }
        }
    });
    $(".divlayout_id ").hide();
    $("#layouts").on("change", function(){
        if($(this).val() == 4) {
           $(".divlayout_id ").show();
        } else {
           $(".divlayout_id ").hide();
        }
    })
    <% var layout =  data.layouts == "4" ? `$(".divlayout_id ").show();` : `$(".divlayout_id ").hide();` %>
    <%- layout%>
</script>

Error in console log
image

Version

v7.2.0

What browsers are you seeing the problem on?

Chrome

Link to reproduce

https://github.com/terser/html-minifier-terser

Relevant log output

<script>submitForm("form-group","","/<%- routeName %>"),$(window).keydown((function(t){if(13==t.keyCode&&"input"==$(t.target).attr("type"))return t.preventDefault(),!1})),$(".divlayout_id ").hide(),$("#layouts").on("change",(function(){4==$(this).val()?$(".divlayout_id ").show():$(".divlayout_id ").hide()}))</script>
<% var layout =  data.layouts == "4" ? `$(".divlayout_id ").show();` : `$(".divlayout_id ").hide();` %>,<%- layout%>

Willing to submit a PR?

Yes

@DanielRuf
Copy link
Contributor

See #161 (comment)

@sintret sintret closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants