Is it wrong to place the [removed] tag after the </body> tag?

前端 未结 8 998
长情又很酷
长情又很酷 2020-11-22 06:12

How wrong is it to place the script tag after the closing tag of the body (). ?


  ....
  
     ....
  <         


        
相关标签:
8条回答
  • 2020-11-22 06:32

    Procedurally insert "element script" after "element body" is "parse error" by recommended process by W3C. In "Tree Construction" create error and run "tokenize again" to process that content. So it's like additional step. Only then can be runned "Script Execution" - see scheme process.

    Anything else "parse error". Switch the "insertion mode" to "in body" and reprocess the token.

    Technically by browser it's internal process, how they mark and optimize it.

    I hope I helped somebody.

    0 讨论(0)
  • 2020-11-22 06:39

    Google actually recommends this in regards to 'CSS Optimization'. They recommend in-lining critical above-fold styles and deferring the rest(css file).

    Example:

    <html>
      <head>
        <style>
          .blue{color:blue;}
        </style>
        </head>
      <body>
        <div class="blue">
          Hello, world!
        </div>
      </body>
    </html>
    <noscript><link rel="stylesheet" href="small.css"></noscript>
    

    See: https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery

    0 讨论(0)
提交回复
热议问题