在Umbraco中,内联javascript在Chrome中变为小写

时间:2015-06-17 07:58:04

标签: javascript google-chrome umbraco umbraco7

使用Umbraco 7.2,当我尝试编写内联的javascript(在模板页面上)当我查看它打破的页面时,使用chrome dev工具我注意到它将所有的javascript转换为小写,所以" .addClass&# 34;成为" .addclass"并没有得到认可 奇怪的是,这似乎只发生在chrome中,在Firefox和IE中它显示正确。

我知道使用内联javascript不是Umbraco的最佳做法,但有人能告诉我它为什么会这样做吗?

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
    Layout = null;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>

    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/style.css" />
    <script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
<body>
    <header>
        <nav class="nav-menu">
                <ul class="nav-menu-main">
                    <li><a href="/" class="nav-home glyphicon glyphicon-home"></a></li>
                    <li>
                        <a href="/">one</a><span></span>
                 <ul class="nav-menu-sub">
                @foreach (var item in CurrentPage.Site().adviserZone)
            {
                var linkUrl = (bool)item.isInternal ? Umbraco.NiceUrl(item.Value<int>("internal")) : item.link;
                var linkTarget = (bool)item.newWindow ? "_blank" : null;
                <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li>
            }  
                </ul>            
                    </li>

                    <li>
                        <a href="/">two</a><!--<span class="caret"></span>-->
                 <ul class="nav-menu-sub">
                @foreach (var item in CurrentPage.Site().knowledgeCentre)
            {
                var linkUrl = (bool)item.isInternal ? Umbraco.NiceUrl(item.Value<int>("internal")) : item.link;
                var linkTarget = (bool)item.newWindow ? "_blank" : null;
                <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li>
            }  
                </ul> 
                    </li>
                    <li>
                        <a href="/partners">three</a><span></span>
                 <ul class="nav-menu-sub">
                @foreach (var item in CurrentPage.Site().partners)
            {
                var linkUrl = (bool)item.isInternal ? Umbraco.NiceUrl(item.Value<int>("internal")) : item.link;
                var linkTarget = (bool)item.newWindow ? "_blank" : null;
                <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li>
            }  
                </ul> 
                    </li>
                                        <li>
                        <a href="/">four</a><span></span>
                 <ul class="nav-menu-sub">
                @foreach (var item in CurrentPage.Site().products)
            {
                var linkUrl = (bool)item.isInternal ? Umbraco.NiceUrl(item.Value<int>("internal")) : item.link;
                var linkTarget = (bool)item.newWindow ? "_blank" : null;
                <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li>
            }  
                </ul> 
                    </li>
                    <li>
                        <a href="/">five</a><span></span>
                 <ul class="nav-menu-sub">
                @foreach (var item in CurrentPage.Site().inTheNews)
            {
                var linkUrl = (bool)item.isInternal ? Umbraco.NiceUrl(item.Value<int>("internal")) : item.link;
                var linkTarget = (bool)item.newWindow ? "_blank" : null;
                <li><a href="@linkUrl" target="@linkTarget">@item.caption</a></li>
            }  
                </ul>  
                    </li>
                </ul>
        </nav>

        @{
           IPublishedContent current = (CurrentPage);
           Stack<dynamic> pages = new Stack<dynamic>();
           while (current.Level > 1)
          {
              pages.Push(current);
             current = current.Parent;
         }
        }
        <div class="breadcrumb-bar">
            <ul class="breadcrumbs container">
                <li><a href="/">Home</a></li>
                @foreach (var page in pages)
                {
                    var cls = page.Id == CurrentPage.Id ? "current" : "";
               <li class="@cls"><a href="@page.Url">@page.Name.ToLower()</a></li>
              } 
            </ul>
        </div>
    </header>
    <div class="container body-content">
        @RenderBody()
    </div>
        <footer>
        </footer>

    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    <script src="/bootstrap/js/bootstrap.2.3.2.js"></script>
    @*<script type="text/javascript" src="/scripts/main.js"></script>*@
    <script>
        var menuItem = $(".nav-menu-main > li > a");
        var subMenu = $(".nav-menu-sub")
        $(subMenu).mouseover(function () {
            $(this).parent().children(menuItem).addClass("hover-active");
        });
        $(subMenu).mouseout(function () {
            $(this).parent().children(menuItem).removeClass("hover-active");
        });
    </script>
</body>
</html>

0 个答案:

没有答案