Add HTML Comment node

https://dom.spec.whatwg.org/#interface-comment
This commit is contained in:
iska
2015-02-26 20:08:06 +01:00
parent 5e9846b8ea
commit c45adc581b
4 changed files with 70 additions and 2 deletions
+41
View File
@@ -0,0 +1,41 @@
//
// HTMLComment.m
// HTMLKit
//
// Created by Iska on 25/02/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import "HTMLComment.h"
@implementation HTMLComment
- (instancetype)initWithData:(NSString *)data
{
self = [super initWithName:@"#comment" type:HTMLCommentNode];
if (self) {
self.data = data ?: @"";
}
return self;
}
- (NSString *)textContent
{
return self.data;
}
- (void)setTextContent:(NSString *)textContent
{
self.data = textContent ?: @"";
}
#pragma mark - NSCopying
- (id)copyWithZone:(NSZone *)zone
{
HTMLComment *copy = [super copyWithZone:zone];
copy.data = self.data;
return copy;
}
@end