Permalink
Browse files

Improve inline tag category

  • Loading branch information...
soffes committed Jan 14, 2011
1 parent 18e9736 commit 4d6189b33417f0eea1a4045771947e2757c11802
Showing with 8 additions and 11 deletions.
  1. +8 −11 Classes/NSString+HTML.m
View
@@ -8,6 +8,8 @@
#import "NSString+HTML.h"
+static NSSet *inlineTags = nil;
+
@implementation NSString (HTML)
- (NSDictionary *)dictionaryOfAttributesFromTag
@@ -81,18 +83,13 @@ - (NSUInteger)integerValueFromHex
- (BOOL)isInlineTag
{
- NSString *tag = [self lowercaseString];
-
- BOOL inlineTag = ([tag isEqualToString:@"font"] ||
- [tag isEqualToString:@"b"] ||
- [tag isEqualToString:@"strong"] ||
- [tag isEqualToString:@"em"] ||
- [tag isEqualToString:@"i"] ||
- [tag isEqualToString:@"sub"] ||
- [tag isEqualToString:@"sup"] ||
- [tag isEqualToString:@"u"]);
+ if (!inlineTags)
+ {
+ inlineTags = [[NSSet alloc] initWithObjects:@"font", @"b", @"strong", @"em", @"i", @"sub", @"sup",
+ @"u", @"a", nil];
+ }
- return inlineTag;
+ return [inlineTags containsObject:[self lowercaseString]];
}
@end

0 comments on commit 4d6189b

Please sign in to comment.