Skip to content

Add 'OTHER_DIRECTIVE' category to attributes-order #518

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

Conversation

ElMassimo
Copy link

@ElMassimo ElMassimo commented Jul 11, 2018

Follow-up to #209, fixes an issue where custom directives are required to go first, before v-for and v-if:

screen shot 2018-07-11 at 10 39 08 am

Description 📖

This pull request adds an OTHER_DIRECTIVE category for any directives that don't match the existing:

  • LIST_RENDERING
  • CONDITIONALS
  • RENDER_MODIFIERS
  • BINDING
  • EVENTS
  • CONTENT

allowing to order custom directives as necessary (by default, after the unique modifiers). This is specially convenient so that v-for and v-if come before custom directives.

Example ✅

Before

<input v-autofocus v-if="displayInput"/>

After

<input v-if="displayInput" v-autofocus/>

@@ -23,6 +23,8 @@ function getAttributeType (name, isDirective) {
return 'EVENTS'
} else if (name === 'html' || name === 'text') {
return 'CONTENT'
} else {
return 'OTHER_DIRECTIVE'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment this category is not defined, so custom directives are always required to go first.

@michalsnik
Copy link
Member

Hey @ElMassimo ! Thanks for working on it, however we already have a PR with such change I think: #421
It is waiting for the next major release, that's coming really soon now.

@michalsnik michalsnik closed this Jul 11, 2018
@ElMassimo ElMassimo deleted the feature/attributes-order-custom-directive branch July 12, 2018 05:03
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

Successfully merging this pull request may close these issues.

2 participants