简体   繁体   English

为什么我的脚本标签显示在我的身体标签之外?

[英]Why are my script tags rendered outside my body tag?

This is my nhaml code 这是我的nhaml代码

^ var title=""
!!! XML
!!! Strict
%html{xmlns="http://www.w3.org/1999/xhtml"}
  %head
    %title
      Nhaml Master #{title}
      _styles
    %body
  .page      
        %h1 = "hello world"
        _
        _scripts

The resulting HTML renders the last tags as such: 生成的HTML会这样渲染最后一个标签:

    </div>
  </body>
        <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript">
        </script>

</html>

As _scripts is still at the indentation level of %body +1, why does it close body down before rendering _scripts? 由于_scripts仍处于%body +1的缩进级别,为什么在渲染_scripts之前关闭body?

Does it work if you move the scripts above the partial? 如果将脚本移到部分脚本上方,是否可以正常工作? If so, then the partial may be to blame. 如果是这样,那么可能是部分原因。

   %h1 = "hello world"
    _scripts
    _

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM