Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convenience class method to know if a doctype will produce XHTML

  • Loading branch information...
commit 3e35588a245e032cc78aead18c235f2db005f012 1 parent 2678f4e
@mikeabdullah mikeabdullah authored
Showing with 10 additions and 3 deletions.
  1. +1 −0  KSHTMLWriter.h
  2. +9 −3 KSHTMLWriter.m
View
1  KSHTMLWriter.h
@@ -61,6 +61,7 @@ extern NSString *KSHTMLWriterDocTypeHTML_5;
// Whether empty elements should be written as <FOO> or <FOO />
// Default is YES. There's no setter method; instead, specify with -startDocumentWithDocType:encoding: or when initializing.
- (BOOL)isXHTML;
++ (BOOL)isDocTypeXHTML:(NSString *)docType;
#pragma mark CSS Class Name
View
12 KSHTMLWriter.m
@@ -92,13 +92,19 @@ - (void)setDocType:(NSString *)docType;
docType = [docType copy];
[_docType release]; _docType = docType;
- _isXHTML = !([docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Strict] ||
- [docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Transitional] ||
- [docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Frameset]);
+ _isXHTML = [[self class] isDocTypeXHTML:docType];
}
- (BOOL)isXHTML; { return _isXHTML; }
++ (BOOL)isDocTypeXHTML:(NSString *)docType;
+{
+ BOOL result = !([docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Strict] ||
+ [docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Transitional] ||
+ [docType isEqualToString:KSHTMLWriterDocTypeHTML_4_01_Frameset]);
+ return result;
+}
+
#pragma mark CSS Class Name
- (NSString *)currentElementClassName;

0 comments on commit 3e35588

Please sign in to comment.
Something went wrong with that request. Please try again.