Permalink
Browse files

Ignore !important CSS tag

fixes #358
  • Loading branch information...
1 parent db952fd commit 59b8a0372eb6a76fb6b6c0f0f3ea2d9ac0e37719 @odrobnik odrobnik committed Mar 24, 2013
Showing with 16 additions and 0 deletions.
  1. +16 −0 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];

0 comments on commit 59b8a03

Please sign in to comment.