简体   繁体   English

Telerik UI干扰了自己的风格

[英]Telerik UI interfering with its own styles

So on my current project we've run into a particularly pernicious issue in the last couple weeks: Telerik RadWindow styles are no longer rendering properly. 所以在我目前的项目中,我们在过去几周遇到了一个特别有害的问题:Telerik RadWindow样式不再正常呈现。 There seems to be some extra space around the border, the window icon is sitting flush at the top left, and the title bar buttons exist, but their icons are invisible. 边框周围似乎有一些额外的空间,窗口图标在左上方齐平,标题栏按钮存在,但它们的图标是不可见的。 We're experiencing the exact same issues with RadAlert and RadWindow, alike. 我们遇到的问题与RadAlert和RadWindow完全相同。 My teammates are also using Firefox and IE, and they've been having the exact same issue. 我的队友也使用Firefox和IE,他们一直有同样的问题。

However: this problem isn't exhibited on all pages. 但是:所有页面都没有显示此问题。 Whether RadWindows look fine on a given page is always consistent for that page. RadWindows在给定页面上是否正常,对于该页面始终是一致的。 Earlier I had noticed that where the window appears correctly, Chrome was downloading a fresh stylesheet each time, although disabling caching didn't change anything. 早些时候我注意到,当窗口正确显示时,Chrome每次都会下载一个新的样式表,尽管禁用缓存并没有改变任何东西。

I noticed that the URL used for the buggy stylesheet is different from the normal one. 我注意到用于错误样式表的URL与正常样式表不同。 I broke down the query strings for comparison, and the _TSM_CombinedScripts_ parameter gives different public key tokens. 我分解了查询字符串以进行比较, _TSM_CombinedScripts_参数给出了不同的公钥标记。 They're actually identical at the beginning, but by the end they're completely different. 它们在开始时实际上是相同的,但到最后它们完全不同。

normal:

d=d_7ijIXc06Eqg7xyrMT_AE_WxZL3XaVJz_VwsvOdK_1ssgHIAGoqaJzPVn-aFQFJVakZqv0a6M6IUW8lKaDBl-g9FohhCb-0KC2Mu14d6L4y47PrZb-wQiVUGqaxwCy7qcc2Dw2
t=635823632443834005
compress=1
_TSM_CombinedScripts_=
    ;;Telerik.Web.UI, Version=2014.3.1209.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:cd668efa-682a-4e93-b784-26f0724f247c:92753c09:ed2942d4:580b2269:8cee9284:a3b7d93f:9e1572d6:aac1aeb7:1c2121e:4d471440:c86a4a06:45085116
    ;Telerik.Web.UI.Skins, Version=2014.3.1209.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:a1fec5ec-d336-48a8-850e-06eaadf10400:62641802:f82ffad1:9db7724d:fa319bc5:226a649d:51352d27:8b77daa8:976fe3c:f144572

buggy:

d=d_7ijIXc06Eqg7xyrMT_AE_WxZL3XaVJz_VwsvOdK_1ssgHIAGoqaJzPVn-aFQFJVakZqv0a6M6IUW8lKaDBl-g9FohhCb-0KC2Mu14d6L4y47PrZb-wQiVUGqaxwCy7qcc2Dw2
t=635823632443834005
compress=1
_TSM_CombinedScripts_=
    ;;Telerik.Web.UI, Version=2014.3.1209.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:cd668efa-682a-4e93-b784-26f0724f247c:92753c09:ed2942d4:580b2269:1c2121e:9e1572d6:45085116
    ;Telerik.Web.UI.Skins, Version=2014.3.1209.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4:en-US:a1fec5ec-d336-48a8-850e-06eaadf10400:62641802:f82ffad1:9db7724d:8b77daa8:226a649d

各种各样的

As for the actual bug, I did a little inspecting, an I found that the stylesheet actually overrides its own styles. 至于实际的bug,我做了一些检查,我发现样式表实际上覆盖了自己的样式。 I ran the stylesheet returned by Telerik.UI.Webresource.axd through a formatter, and line 216 defines a couple rules: 我通过格式化程序运行Telerik.UI.Webresource.axd返回的样式表,第216行定义了一些规则:

.RadWindow .rwCloseButton {
    background-position: -90px 0
}

.RadWindow .rwCloseButton:hover {
    background-position: -90px -21px
}

Then on line 4634 it overrides them. 然后在第4634行,它会覆盖它们。 The buggy stylesheet has about 2600 extra lines overall. 有缺陷的样式表总共有大约2600个额外的行。 Strangely enough, these new rules apply the regular close button style to hovered close buttons in inactive windows as well. 奇怪的是,这些新规则也适用于常规关闭按钮样式,以便在非活动窗口中悬停关闭按钮。

.RadWindow .rwCloseButton,
.RadWindow.rwInactiveWindow .rwCloseButton:hover {
    background-position: -1px -762px
}

.RadWindow .rwCloseButton:hover {
    background-position: -21px -762px
}

On pages where windows appear correctly, only the first two rules are applied, and the second set of rules never makes an appearance. 在窗口正确显示的页面上,仅应用前两个规则,第二组规则永远不会出现。 I just don't understand how it puts together the styles or why it's overriding itself. 我只是不明白它是如何组合风格或为什么它压倒自己。

As far as I can tell, none of the references have been changed. 据我所知,没有任何参考文献被改变。 Nothing's been upgraded, the web.config hasn't changed. 没有任何升级,web.config没有改变。 We're seeing the same issue both in our local environments and on our dev box. 我们在本地环境和开发箱中都看到了同样的问题。

Either removing RenderMode="Lightweight" from all RadWindows or making sure all RadWindows have it fixes the problem. 从所有RadWindows中删除RenderMode="Lightweight"或确保所有RadWindows都能解决问题。

Turns out the problem was that one of our team members added some RadWindows with RenderMode="Lightweight" to a few pages. 事实证明,我们的团队成员之一将RenderMode="Lightweight"一些RadWindows添加到几页。 Presumably, the second stylesheet that was loaded was actually for lightweight mode. 据推测,加载的第二个样式表实际上是用于轻量级模式。 This would be why the docs tell you not to mix render modes. 这就是文档告诉您不要混合渲染模式的原因。

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

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