Skip to content

Rhino is only JS 1.7 compatible - prevents using modern JS syntax #38

@rob99

Description

@rob99

I'm putting this here for documentation as much as anything. It's not clear to me if Mozilla Rhino will ever be made ECMAscript 6 compliant or be kept up to date in general...

I've found that using therubyrhino in a rails 4.2 application on JRuby that rake assets:precompile will fail even though my javascript executes without error in the browser.

This appears to be because Mozilla Rhino is only JS 1.7 compliant, whereas my browser can execute v6.

E.g.:

jirb
irb(main):001:0> require 'rhino'
=> true
irb(main):002:0> eval_js "7 * 6"
=> 42
irb(main):003:0> eval_js "var a = 1"
=> nil
irb(main):004:0> eval_js "let a = 1"
Rhino::JSError: missing ; before statement

Not sure if the solution is to have JRuby move to another Java JS engine (are there any?) or somehow make rake assets:precompile not do syntax checking, or get Mozilla Rhino updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions