Add "description" methods for HTML Nodes
This commit is contained in:
@@ -38,4 +38,11 @@
|
||||
return copy;
|
||||
}
|
||||
|
||||
#pragma mark - Description
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p <!-- %@ -->>", self.class, self, self.data];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -48,4 +48,11 @@
|
||||
return copy;
|
||||
}
|
||||
|
||||
#pragma mark - Description
|
||||
|
||||
- (NSString *)description
|
||||
{
|
||||
return [NSString stringWithFormat:@"<%@: %p \"%@\">", self.class, self, self.data];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user