public Style AddRule(string selector) { styleSheet.InsertRule(selector + "{}", 0); var elementStyle = styleSheet.CssRules[0].Style; var style = new Style(); style.Attach(elementStyle); return style; }
public void ApplyTo(Style other) { if (node == null) { if (other.node == null) { other.actions = actions.ToList(); } else { foreach (var action in actions) { action.Act(other); } } } else { throw new Exception("Cannot apply a style that has already been attached."); } }
public Style Clone() { if (node == null) { var result = new Style(); result.actions = actions.ToList(); return result; } else { throw new Exception("Cannot clone a style that has already been attached. (Cloning of styles is intended to support \"template\" styles for which attaching is not intended."); } }