public void StyleAddTest() { var style = new style(); style.add("border: 5px solid red; background-image: value", "base"); style.add("border: 5px solid red!important; background-image: value", "base"); }
public void parse_stylesheet(string str, string baseurl, document doc, media_query_list media) { var text = str; // remove comments var c_start = text.IndexOf("/*"); while (c_start != -1) { var c_end = text.IndexOf("*/", c_start + 2); text = text.Substring(0, c_start) + text.Substring(c_end + 2); c_start = text.IndexOf("/*"); } var pos = text.FindFirstNotOf(" \n\r\t"); while (pos != -1) { while (pos != -1 && text[pos] == '@') { var sPos = pos; pos = text.IndexOfAny(delims1, pos); if (pos != -1 && text[pos] == '{') { pos = html.find_close_bracket(text, pos, '{', '}'); } parse_atrule(pos != -1 ? text.Substring(sPos, pos - sPos + 1) : text.Substring(sPos), baseurl, doc, media); if (pos != -1) { pos = text.FindFirstNotOf(" \n\r\t", pos + 1); } } if (pos == -1) { break; } var style_start = text.IndexOf("{", pos); var style_end = text.IndexOf("}", pos); if (style_start != -1 && style_end != -1) { var st = new style(); st.add(text.Substring(style_start + 1, style_end - style_start - 1), baseurl); parse_selectors(text.Substring(pos, style_start - pos), st, media); if (media != null && doc != null) { doc.add_media_list(media); } pos = style_end + 1; } else { pos = -1; } if (pos != -1) { pos = text.FindFirstNotOf(" \n\r\t", pos); } } }