Mithun
Mithun

Reputation: 8067

Jade code not generating closing tags

I have following Jade code, but it generates the HTML code erroneously. The closing tags are not generated for some of the tags. Please find the same Jade and the corresponding HTML code:

Jade code:

doctype html
html(ng-app="eperf", ng-controller="appCntrl as ac", xmlns="http://www.w3.org/1999/xhtml", xmlns:th="http://www.thymeleaf.org", xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3")
  head
    title(ng-bind="ac.pageTitle()") AESOP
    meta(name='viewport', content="width=device-width, initial-scale=1")
    link(href="lib/bootstrap/3.3.1/css/bootstrap.css", rel="stylesheet")

Generated HTML Code:

<!DOCTYPE html>
<html ng-app="eperf" ng-controller="appCntrl as ac" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
  <head>
    <title ng-bind="ac.pageTitle()">AESOP</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="lib/bootstrap/3.3.1/css/bootstrap.css" rel="stylesheet">
  </head>
</html>

The closing tags are missing for the <meta> and <link> tags. I am using this online tool for testing. Could someone please let me know the issue with my Jade code?

Upvotes: 0

Views: 342

Answers (1)

satchcoder
satchcoder

Reputation: 797

Your code is correct. Some tags are self closing tags but they don't need to be closed because the HTML5 compliant browsers will add the closing tag themselves.

http://tiffanybbrown.com/2011/03/23/html5-does-not-allow-self-closing-tags/

Upvotes: 1

Related Questions