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

this[dispatch] is not a function #10

Open
chevett opened this issue Nov 16, 2015 · 4 comments
Open

this[dispatch] is not a function #10

chevett opened this issue Nov 16, 2015 · 4 comments
Labels

Comments

@chevett
Copy link
Owner

chevett commented Nov 16, 2015

getting a not very helpful error message. i suspect i have poorly formatted tags, but I'm having a hard time tracking them down.

/home/chevett/code/vashify/node_modules/vash/lib/parser.js:108
  var consumed = this[dispatch](this.node, curr, next, ahead, nnwon);
                               ^

TypeError: this[dispatch] is not a function
    at Parser.read (/home/chevett/code/vashify/node_modules/vash/lib/parser.js:108:32)
    at Object.exports.compile (/home/chevett/code/vashify/node_modules/vash/index.js:62:33)
    at Stream.<anonymous> (/home/chevett/code/vashify/index.js:33:60)
    at _end (/home/chevett/code/vashify/node_modules/through/index.js:65:9)
    at Stream.stream.end (/home/chevett/code/vashify/node_modules/through/index.js:74:5)
    at DestroyableTransform.onend (/home/chevett/relay/admin-site/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:543:10)
    at DestroyableTransform.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at DestroyableTransform.emit (events.js:166:7)
    at endReadableNT (/home/chevett/relay/admin-site/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:958:12)
@chevett
Copy link
Owner Author

chevett commented Nov 16, 2015

@kirbysayshi any tips for making this more informative? this is probably due to improperly closed tags or something, right?

@kirbysayshi
Copy link
Collaborator

I just saw a similar error the other day from properly nested tags, but some complicated attribute values that vash wasn't expecting (xml namespaces). I believe this is a bug where the parser gets to a state that should be impossible... if you have html that is causing this, definitely send it over if possible! In the meantime I'll try to catch the bad state. But a patch won't come until tomorrow at the earliest.

One thing you can try is to remove "complicated" bits of the template, and try to narrow down what's causing it. Or something like bisecting the template with a binary search-esque spree. If you're feeling adventurous, you can run your browserify command with the DEBUG env variable set to * to see what vash's parser is doing (and lexer, and codegen).

$ DEBUG=* browserify -t vashify your.entry.js

@chevett
Copy link
Owner Author

chevett commented Nov 16, 2015

Cool, I'll def try to get that html and I don't need a super quick
turnaround, so no pressure! Right now I'm struggling to even know which
file has the bad tags. I've done zero digging thus far, so I'll give that
a try today. Thanks!
On Nov 16, 2015 1:25 AM, "Andrew Petersen" notifications@github.com wrote:

I just saw a similar error the other day from properly nested tags, but
some complicated attribute values that vash wasn't expecting (xml
namespaces). I believe this is a bug where the parser gets to a state that
should be impossible... if you have html that is causing this, definitely
send it over if possible! In the meantime I'll try to catch the bad state.
But a patch won't come until tomorrow at the earliest.

One thing you can try is to remove "complicated" bits of the template, and
try to narrow down what's causing it. Or something like bisecting the
template with a binary search-esque spree. If you're feeling adventurous,
you can run your browserify command with the DEBUG env variable set to *
to see what vash's parser is doing (and lexer, and codegen).

$ DEBUG=* browserify -t vashify your.entry.js


Reply to this email directly or view it on GitHub
#10 (comment).

@chevett
Copy link
Owner Author

chevett commented Dec 2, 2015

<div>
    <div></div>
    </div>
</div>

this appears to be the simplest thing that will cause this error. I was only able to track this down by modifying vash/lib/parser.js and logging this.inputText if this[dispatch] was falsy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants