1

Any ideas what to do, whit this error?

The simple test as angular v12, Universal SSR fail the W3 HTML validation.

the AppComponent have a selector like:

@Component({
selector: 'app',
templateUrl: './app.component.html',
encapsulation: ViewEncapsulation.None
})

and on index

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <app id="app"></app>
</body>
</html>

But W3 HTML validation shows an error:

enter image description here

I also try to change the selector name to like: 'project' and I got the same error

enter image description here

jcdsr
  • 1,123
  • 1
  • 17
  • 35

1 Answers1

3

Edit: Use a name with a dash in it, such as app-root

Weirdly, the validator will not complain about app-root or other angular directive tags, but will complain for all _ngcontent-** attribute.

Note that there is a message filtering feature in the w3c validator so that you can ignore specific warnings (like the ngcontent attribute) (message from w3c maintainer here)

David
  • 33,444
  • 11
  • 80
  • 118