diff --git a/HTMLKitTests/HTML5LibTest.m b/HTMLKitTests/HTML5LibTest.m index 81eb1cc..be45672 100644 --- a/HTMLKitTests/HTML5LibTest.m +++ b/HTMLKitTests/HTML5LibTest.m @@ -92,9 +92,10 @@ } else if ([type isEqualToString:@"Comment"]) { return [[HTMLCommentToken alloc] initWithData:data]; } else if ([type isEqualToString:@"DOCTYPE"]) { + data = [[NSNull null] isEqualTo:data] ? nil : data; HTMLDOCTYPEToken *token = [[HTMLDOCTYPEToken alloc] initWithName:data]; - token.publicIdentifier = [[NSNull null] isEqual:output[2]] ? nil : output[2]; - token.systemIdentifier = [[NSNull null] isEqual:output[3]] ? nil : output[3]; + token.publicIdentifier = [[NSNull null] isEqualTo:output[2]] ? nil : output[2]; + token.systemIdentifier = [[NSNull null] isEqualTo:output[3]] ? nil : output[3]; token.forceQuirks = ([output[4] boolValue] == NO); return token; } else if ([type isEqualToString:@"EndTag"]) { @@ -104,6 +105,9 @@ } else if ([type isEqualToString:@"StartTag"]) { HTMLStartTagToken *token = [[HTMLStartTagToken alloc] initWithTagName:data]; NSDictionary *attributes = output[2]; + if (attributes && attributes.allKeys.count > 0) { + token.attributes = [NSMutableDictionary new]; + } for (NSString *name in attributes) { NSString *value = [attributes objectForKey:name]; [token.attributes setObject:value forKey:name];