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

SyntaxError: Unexpected token (CLASS, 'class') #103

Open
FVolral opened this issue Jul 19, 2018 · 1 comment
Open

SyntaxError: Unexpected token (CLASS, 'class') #103

FVolral opened this issue Jul 19, 2018 · 1 comment

Comments

@FVolral
Copy link

FVolral commented Jul 19, 2018

When I try to parse a code containing the following :

 _edit: function () {
        if (this.options.can_edit) {
            var self = this;
            var $input = $('<input>', {class: 'o_input', type: 'text', value: this.$value.html()});

            this.$value.html($input);
            $input.focus();

            // Event handlers
            $input.click(function(ev) {
                ev.stopPropagation(); // ignore clicks on the input
            });
            $input.blur(function(ev) {
                self._save($(ev.target)); // save the state when leaving the input
            });
            $input.on('keydown', function (ev) {
                ev.stopPropagation();
                if (ev.which === $.ui.keyCode.ENTER) {
                    self._save($(ev.target)); // save on enter
                } else if (ev.which === $.ui.keyCode.ESCAPE) {
                    self._render(); // leave on escape
                }
            });
        }
    },

it raise this error message :

SyntaxError: Unexpected token (CLASS, 'class') at 1:5220 between LexToken(LBRACE,'{',1,5219) and LexToken(COLON,':',1,5225)

it looks like a bug.

@metatoaster
Copy link

metatoaster commented Aug 7, 2018

Yes, it's a known bug, see #52 and #59.

Basically any reserved keyword cannot be used as keys (or variables/attributes) through the slimit parser.

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