Skip to content

const not supported in javascript for loop #449

Description

@jpschewe

When parsing the following javascript htmlunit fails to parse. If "const" is removed from the for loop, then the parsing succeeds.

Minimal code example:
test.js

function checkSomethingToPrint() {
    let arr = new Array();
    for(const e of arr) {
        alert("here");
    }
}

test.html

<html>
  <head>
    <script src="test.js" type="text/javascript"></script>
  </head>
</html>

App.java

import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;

public class App {
  
  public static void main(String[] args) throws Exception {
    try (final WebClient webClient = new WebClient()) {
      File file = new File("test.html");
      final HtmlPage page = webClient.getPage(file.toURI().toURL());
    }
  }
}

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    js-engineIssues related to the js engineworkaround availableThere is a workaround available

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions