.html() is undefined when template root tag is <a>
See original GitHub issuethe html() method returns a undefined when the root tag of a template is a link tag. Vue does not give me any errors but could it be that the root element should not have any bindings attached or so?
Not working example:
<template>
<a
class="teaser__link teaser__posterholder"
:href="this.href"
v-if="this.teaser && this.teaser.crops[1]"
>
<figure class="poster">
<div class="poster__placeholder">
<img
src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
:alt="this.title"
:data-srcset="teaserImageSrcSet"
>
</div>
</figure>
</a>
</template>
while this is working even the root tag is still not a block tag:
<template>
<span>
<a
class="teaser__link teaser__posterholder"
:href="this.href"
v-if="this.teaser && this.teaser.crops[1]"
>
...........
</a>
</span>
</template>
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
"Error: Template must have exactly one root element" when ...
your indexCtrl is not referenced in your html (ng-controller). You shouldn't init your selected variable with undefined use $scope.selected ...
Read more >The Content Template element - HTML - MDN Web Docs
The HTML element is a mechanism for holding HTML that is not to be rendered immediately when a page is loaded but may...
Read more >Handling Null Values in HTML Templates with Angular
Null or undefined values are never in your control when your app is talking to in-house developed APIs or third-party APIs.
Read more >API - Ractive
This is a collection of helper functions that do things like parse a template, provide instance-free access to cross-instance state, create or augment...
Read more >Template type checking - Angular
Verifies that component/directive bindings are assignable to their @Input() s; Obeys TypeScript's strictNullChecks flag when validating the preceding mode ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This should be fixed in 6.0.1 🙌
@willypt
here is the component: https://gist.github.com/podlebar/448d11a959a51a7373a71f24b531be7f and here the test: https://gist.github.com/podlebar/469c1764ef2aa3f7c9bd760403ab2c4e
the first span in the component i would like to remove… but when i remove it wrapper.html() is undefined… with span it works good.