简体   繁体   English

XQuery和html条件注释

[英]XQuery and html conditional comments

After reading some of the other questions on here and trying their solutions, I still have this issue with XQuery. 在阅读了此处的其他一些问题并尝试了其解决方案之后,XQuery仍然存在这个问题。

We are using a conditional comment to see if IE is being used. 我们正在使用条件注释来查看是否正在使用IE。 We are dynamically building paths to our javascript files like so. 我们正在像这样动态地构建到我们的javascript文件的路径。

<!--[if lte IE]>
<script type="text/javascript" src="{$layout:cdnPath}/scripts/browser-detect-admin.js">&nbsp;</script>
<![endif]-->

But it seems that the script element is being evaluated as text and not building the correct path to our javascript. 但是似乎script元素正在被评估为文本,而不是为我们的javascript构建正确的路径。 It is thinking that {$layout:cdnPath}/scripts/browser-detect-admin.js is the path to the file. 认为{$ layout:cdnPath} /scripts/browser-detect-admin.js是文件的路径。 I can't figure out why. 我不知道为什么。

I tested this in IE 7,8 and also in IE 9 compatibility mode. 我在IE 7,8和IE 9兼容模式下对此进行了测试。

That is correct. 那是对的。 Such expression templates are not evaluated within literal comment. 此类表达模板不在文字注释内评估。 Use a comment constructor instead: 使用注释构造函数:

comment {concat('[if lte IE]>
<script type="text/javascript" src="', $layour:cdnPath, '/scripts/browser-detect-admin.js">&nbsp;</script>
<![endif]')}

HTH 高温超导

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

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