mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
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:
parent
49317ec33f
commit
d1fd7cd271
@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user