mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
#18419: Fixing !IE conditional comments
Work Item: 18419 --HG-- branch : 1.x
This commit is contained in:
@@ -24,6 +24,8 @@ namespace Orchard.UI.Resources {
|
||||
private List<String> _footScripts;
|
||||
private IEnumerable<IResourceManifest> _manifests;
|
||||
|
||||
private const string NotIE = "!IE";
|
||||
|
||||
private static string ToAppRelativePath(string resourcePath) {
|
||||
if (!String.IsNullOrEmpty(resourcePath) && !Uri.IsWellFormedUriString(resourcePath, UriKind.Absolute)) {
|
||||
resourcePath = VirtualPathUtility.ToAppRelative(resourcePath);
|
||||
@@ -58,18 +60,32 @@ namespace Orchard.UI.Resources {
|
||||
|
||||
public static void WriteResource(TextWriter writer, ResourceDefinition resource, string url, string condition, Dictionary<string, string> attributes) {
|
||||
if (!string.IsNullOrEmpty(condition)) {
|
||||
if (condition == NotIE) {
|
||||
writer.WriteLine("<!--[if " + condition + "]>");
|
||||
}
|
||||
else {
|
||||
writer.WriteLine("<!--[if " + condition + "]>-->");
|
||||
}
|
||||
}
|
||||
|
||||
var tagBuilder = GetTagBuilder(resource, url);
|
||||
|
||||
if (attributes != null) {
|
||||
// todo: try null value
|
||||
tagBuilder.MergeAttributes(attributes, true);
|
||||
}
|
||||
|
||||
writer.WriteLine(tagBuilder.ToString(resource.TagRenderMode));
|
||||
|
||||
if (!string.IsNullOrEmpty(condition)) {
|
||||
if (condition == NotIE) {
|
||||
writer.WriteLine("<!--<![endif]-->");
|
||||
}
|
||||
else {
|
||||
writer.WriteLine("<![endif]-->");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceManager(IEnumerable<Meta<IResourceManifestProvider>> resourceProviders) {
|
||||
_providers = resourceProviders;
|
||||
|
||||
Reference in New Issue
Block a user