Skip to content

Support JS dot and bracket notation #36

Description

@kimbauters

In some cases the analysis minifies a selector in the wrong way. Unfortunately, because this is for internal code, I cannot post the full HTML on GitHub. If you want it though, I am happy to send it to you privately.

Hopefully I can describe the issue enough to make it reproducible. Take an HTML form that calls some javascript:

<form action="#" onsubmit="return validate(this);">
    <input type="url" id="url" class="custom-search-input" onkeyup="check(this);" placeholder="https://en.wikipedia.org/wiki/Minification_(programming)">
    <textarea name="message" id="message" class="custom-search-textarea" placeholder="Add a message here"></textarea>
    <button class="custom-search-botton" id="button" type="submit">do it</button>
</form>

The problem now occurs for id url and message. Assume I have this as my JS:

function check(input) {
    ...
    let url = document.getElementById("url");
    ...
}

then url gets minified. However:

function validate(form) {
   next_step(form.url.value, form.message.value);
}

the use of url and message here will not be detected. As a result message does not get minified, while url gets minified but the above code line would not be updated.

edit: sorry, I hit submit too early. Updated to finish the explanation.

edit 2: a further minification could be to also rename JavaScript functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions