Skip to main content
HTML Validation

The “name” attribute is never allowed on the “transition” element.

About This HTML Issue

A Vue template left in the page's HTML puts a name attribute on <transition>, and the validator warns because HTML only defines name for a short list of its own elements.

<Transition> is the Vue component that animates an element as it is added to or removed from the page. Its name prop sets the prefix of the CSS classes Vue applies during the animation, so name="slide" gives you slide-enter-active, slide-leave-to and so on. When Vue mounts onto markup that is already in the page (an in-DOM template, common when Vue is loaded from a CDN without a build step), the browser parses that markup first, and the validator checks it before Vue has compiled anything. Tag names in HTML are case-insensitive, so writing the tag as <Transition> gets the same message.

The warning comes with two errors for the same tag. transition is not an HTML element, and without a hyphen in its name it can't be a custom element either, so the validator reports it as a completely unknown element and as a child that its parent doesn't allow. Removing name clears the warning but leaves both errors, and Vue then falls back to the default v- class prefix.

All three messages go away when Vue's template syntax stays out of the HTML the validator checks. With a build step, put the template in a single-file component (.vue). It is compiled ahead of time, so the template never reaches the page's HTML. Without one, move the template into a <script type="text/x-template"> element and point the app's template option at its id. The validator doesn't check markup inside a script element, and Vue compiles the template the same way.

Invalid example

<div id="app">
  <transition name="slide">
    <p v-if="saved">Changes saved</p>
  </transition>
</div>

Valid example

<div id="app"></div>

<script type="text/x-template" id="app-template">
  <transition name="slide">
    <p v-if="saved">Changes saved</p>
  </transition>
</script>
<script>
  Vue.createApp({
    template: "#app-template",
    data() {
      return { saved: true };
    }
  }).mount("#app");
</script>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries