Skip to content

Uncaught TypeError: Cannot read property '0' of undefined #12

Description

@TanninOne

When parsing tags this code entirely relies on a parse result:

let params = this.parseParams(token.slice(1, -1));
let tagName = params[0][0].toLowerCase();

However parseParam will return an empty array for empty tags or tags that start with on, because of this

      if (name) {
        const n = name.trim();
        // ignore on* events attribute
        if (n.length && n.toLowerCase().indexOf('on') !== 0) {
          params.push([n, value]);
        }
      }

Now "[ ]" is used for example by github for an empty checkbox, [on...] could be all kind of things, both are valid and shouldn't cause the parser to throw an exception.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions