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

[Bug] data-class="" causes the compiler to break unfortunately #34

Closed
Intrflex opened this issue Jan 31, 2022 · 3 comments
Closed

[Bug] data-class="" causes the compiler to break unfortunately #34

Intrflex opened this issue Jan 31, 2022 · 3 comments
Labels
bug Something isn't working contribution welcome Good for newcomers

Comments

@Intrflex
Copy link

Intrflex commented Jan 31, 2022

Minor bug When and div has a data attribute like data-class the compiler can not compile and reports unexpected token :(

<li> <a class="btn js-waves-off" data-action="toggle" data-class="nav-function-fixed" href="#" title="Lock Navigation"> <i class="ni ni-lock-nav" /> </a> </li>

@Intrflex
Copy link
Author

Further testing actually shows its not the data-class.. its the fact i have function inside the class

@JuniorTour
Copy link
Owner

JuniorTour commented Feb 1, 2022

This is a bug.

Thanks for your feedback.


It is caused by use .split('function') for split render function as string:

So the staticRenderFns:

var staticRenderFns = [function () {
  var _vm=this;
  var _h=_vm.$createElement;
  var _c=_vm._self._c||_h;

  return _c('div', {
    attrs: {
      "id": "app"
    }
  }, [_c('a', {
    attrs: {
      "attr": "function"
    }
  }, [_vm._v("1")])]);
}];

will be split wrongly by getArrayItems(compiledStaticRenders) into:
image


Solution:

  1. Maybe we can use a more accurate Regular expression to parse render function?

  2. We can add /* staticRenderSeperator */ during staticRenders.map(), and split functions more accurate:

    code += `var staticRenderFns = [${staticRenderFns.map((render) => toFunction(render, isFunctional))}]`

Welcome for Pull Request! Feel free to ask anything

There is also a CONTRIBUTING.md you can follow.

@JuniorTour JuniorTour added bug Something isn't working contribution welcome Good for newcomers and removed need triage labels Feb 1, 2022
dandanDQ pushed a commit to dandanDQ/vue-template-babel-compiler that referenced this issue Feb 1, 2022
dandanDQ pushed a commit to dandanDQ/vue-template-babel-compiler that referenced this issue Feb 1, 2022
dandanDQ pushed a commit to dandanDQ/vue-template-babel-compiler that referenced this issue Feb 1, 2022
dandanDQ pushed a commit to dandanDQ/vue-template-babel-compiler that referenced this issue Feb 5, 2022
@JuniorTour
Copy link
Owner

@Intrflex We have fixed this issue!

You can try it by run:
npm install vue-template-babel-compiler@latest

Thanks for your feedback again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contribution welcome Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants