163
void update_css_hash (string domain, string value) {
163
bool css_element_seems_valid (string element) {
164
bool is_valid = true;
164
165
string[] valid_elements = { "::after", "::before", "a", "abbr", "address", "article", "aside",
165
166
"b", "blockquote", "caption", "center", "cite", "code", "div", "dl", "dt", "dd", "em",
166
167
"feed", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6",
168
169
"m", "main", "marquee", "menu", "nav", "ol", "option", "p", "pre", "q", "samp", "section",
169
170
"small", "span", "strong", "summary", "table", "tr", "tbody", "td", "th", "thead", "tt", "ul" };
171
if (!value.has_prefix (".") && !value.has_prefix ("#")
172
&& !(value.split("[")[0] in valid_elements))
173
message ("Adblock: Invalid selector: %s", value);
174
string? olddata = element.lookup (domain);
175
if (olddata != null) {
176
string newdata = olddata + " , " + value;
177
element.insert (domain, newdata);
179
element.insert (domain, value);
172
if (!element.has_prefix (".") && !element.has_prefix ("#")
173
&& !(element.split("[")[0] in valid_elements))
177
bool debug_selectors = "adblock:css" in (Environment.get_variable ("MIDORI_DEBUG") ?? "");
179
stdout.printf ("Adblock '%s' %s: %s\n",
180
this.title, is_valid ? "selector" : "INVALID?", element);
185
void update_css_hash (string domain, string value) {
186
if (css_element_seems_valid (value)) {
187
string? olddata = element.lookup (domain);
188
if (olddata != null) {
189
string newdata = olddata + " , " + value;
190
element.insert (domain, newdata);
192
element.insert (domain, value);