Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ignore !important CSS tag

fixes #358
  • Loading branch information...
commit 70c7d48d90e463574657d69e891a28b3216d311c 1 parent c22b7ec
@Cocoanetics Cocoanetics authored committed
Showing with 16 additions and 0 deletions.
  1. +16 −0 Core/Source/DTCSSStylesheet.m
View
16 Core/Source/DTCSSStylesheet.m
@@ -412,6 +412,22 @@ - (void)_addStyleRule:(NSString *)rule withSelector:(NSString*)selectors
NSString *cleanSelector = [selector stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSMutableDictionary *ruleDictionary = [[rule dictionaryOfCSSStyles] mutableCopy];
+
+ // remove !important, we're ignoring these
+ for (NSString *oneKey in [ruleDictionary allKeys])
+ {
+ NSString *value = [ruleDictionary objectForKey:oneKey];
+
+ NSRange rangeOfImportant = [value rangeOfString:@"!important" options:NSCaseInsensitiveSearch];
+
+ if (rangeOfImportant.location != NSNotFound)
+ {
+ value = [value stringByReplacingCharactersInRange:rangeOfImportant withString:@""];
+ value = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+
+ [ruleDictionary setObject:value forKey:oneKey];
+ }
+ }
// need to uncompress because otherwise we might get shorthands and non-shorthands together
[self _uncompressShorthands:ruleDictionary];
Please sign in to comment.
Something went wrong with that request. Please try again.