Improved class attribute logic.

This change fixes that the `"class"` attribute would be added to the tag even if there are no css classes to assign. This in turn has the effect that the root `Canvas` element is not rendering its outer tags needlessly by default (only if it has at least one attribute).
This commit is contained in:
Sipke Schoorstra 2015-12-28 16:05:54 +01:00
parent 49317ec33f
commit d1fd7cd271

View File

@ -1,5 +1,6 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Orchard.DisplayManagement.Shapes;
using Orchard.Layouts.Framework.Elements;
@ -45,7 +46,8 @@ namespace Orchard.Layouts.Helpers {
classes.Add(cssClass);
}
attributes["class"] = String.Join(" ", classes);
if(classes.Any())
attributes["class"] = String.Join(" ", classes);
return attributes;
}
@ -56,4 +58,4 @@ namespace Orchard.Layouts.Helpers {
}
}
}
}
}