public static void RemoveClass(this XElement @this, string @class) { if (@this == null) throw new ArgumentNullException(); var c = @this.ClassAttribute(); if (c != null) { c.Remove(@class); } }
public static void AddClass(this XElement @this, string @class) { if (@this == null) throw new ArgumentNullException(); var c = @this.ClassAttribute(); if (c == null) { @this.Add(c = new XClassAttribute()); } c.Add(@class); }
public static bool HasClass(this XElement @this, string @class) { if (@this == null) throw new ArgumentNullException(); var c = @this.ClassAttribute(); if (c == null) return false; return c.Classes().Contains(@class); }
public static bool HasClassAttribute(this XElement @this) { if (@this == null) throw new ArgumentNullException(); return @this.ClassAttribute() != null; }