Skip to content

rule script in tail

Hanxing Yang edited this page Jul 10, 2016 · 3 revisions

name

script-in-tail

destyleion

All JavaScript content (<script> or <script type="text/javascript">) are recommended to be imported in the tail of <body>, which may improve the first-screen performance. If found not, it reports.

sample

<!-- Bad -->
<head>
    <meta charset="UTF-8">
    <title>sample</title>
    <script src="test.js"></script>
    <script>
        alert('!');
    </script>
</head>
<body>
    <script src="test.js"></script>
    <script>
        alert('!');
    </script>
    <div>
        <script src="test.js"></script>
        <script>
            alert('!');
        </script>
    </div>
</body>

<!-- Good -->
<body>
    <script src="test.js"></script>
    <script>
        alert('!');
    </script>
</body>

code

  • 023

    <script> or <script type="text/javascript"> found not in the tail of <body>.

config

  • true

    Do check / format.

  • false

    Do not check / format.

format support

No.