Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Calling [htmlWriter pushElementAttribute:@"class" value:@"foo"] autom…

…atically pushes that onto the class stack instead.
  • Loading branch information...
commit e96c6c83611a6818815d2d62eeac61e556ad8fb5 1 parent 6bc0b29
@mikeabdullah mikeabdullah authored
Showing with 14 additions and 1 deletion.
  1. +1 −0  KSHTMLWriter.h
  2. +13 −1 KSHTMLWriter.m
View
1  KSHTMLWriter.h
@@ -35,6 +35,7 @@
#pragma mark CSS Class Name
// Class names are accumulated and written automatically as an attribute of the next element started
+// You can also push a class name using -pushElementAttribute:value: if attribute is 'class'
- (void)pushElementClassName:(NSString *)className;
- (NSString *)elementClassName;
View
14 KSHTMLWriter.m
@@ -69,6 +69,18 @@ - (NSString *)elementClassName;
return result;
}
+- (void)pushElementAttribute:(NSString *)attribute value:(NSString *)value;
+{
+ if ([attribute isEqualToString:@"class"])
+ {
+ [self pushElementClassName:value];
+ }
+ else
+ {
+ [super pushElementAttribute:attribute value:value];
+ }
+}
+
- (NSDictionary *)elementAttributes;
{
id result = [super elementAttributes];
@@ -322,7 +334,7 @@ - (void)startElement:(NSString *)elementName writeInline:(BOOL)writeInline; // f
if (class)
{
[_classNames removeAllObjects];
- [self pushElementAttribute:@"class" value:class];
+ [super pushElementAttribute:@"class" value:class];
}
[super startElement:elementName writeInline:writeInline];
Please sign in to comment.
Something went wrong with that request. Please try again.