Add "description" methods for HTML Nodes

This commit is contained in:
iska
2015-03-30 23:28:34 +02:00
parent 83c9841122
commit e157e746a0
5 changed files with 50 additions and 0 deletions
+7
View File
@@ -38,4 +38,11 @@
return copy;
}
#pragma mark - Description
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p <!-- %@ -->>", self.class, self, self.data];
}
@end
+8
View File
@@ -133,4 +133,12 @@ NS_INLINE BOOL nilOrEqual(id first, id second) {
return copy;
}
#pragma mark - Description
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p <!DOCTYPE %@ \"%@\" \"%@\">>",
self.class, self, self.name, self.publicIdentifier, self.systemIdentifier];
}
@end
+22
View File
@@ -96,4 +96,26 @@
return copy;
}
#pragma mark - Description
- (NSString *)description
{
NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: %p ", self.class, self];
if (self.namespace == HTMLNamespaceMathML) {
[description appendString:@"math "];
} else if (self.namespace == HTMLNamespaceSVG) {
[description appendString:@"svg "];
}
[description appendFormat:@"<%@", self.tagName];
[self.attributes enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[description appendFormat:@" %@=\"%@\"", key, obj];
}];
[description appendString:@">>"];
return description;
}
@end
+6
View File
@@ -353,4 +353,10 @@ NS_INLINE void CheckInvalidCombination(HTMLNode *parent, HTMLNode *node, NSStrin
return copy;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p %@>", self.class, self, self.name];
}
@end
+7
View File
@@ -48,4 +48,11 @@
return copy;
}
#pragma mark - Description
- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p \"%@\">", self.class, self, self.data];
}
@end