Merge pull request #24 from CRivlaldo/deepclone

Fix the issue #20
This commit is contained in:
Iskandar Abudiab
2018-03-18 21:19:42 +01:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -144,7 +144,7 @@
{
HTMLElement *copy = [super copyWithZone:zone];
copy->_tagName = [_tagName copy];
copy->_attributes = [_attributes copy];
copy->_attributes = [_attributes mutableCopy];
copy->_htmlNamespace = _htmlNamespace;
return copy;
}
+11
View File
@@ -512,4 +512,15 @@
XCTAssertTrue([image compareDocumentPositionWithNode:outerDiv] == (HTMLDocumentPositionContainedBy | HTMLDocumentPositionFollowing));
}
- (void)testDeepCloneElement {
HTMLElement *element = [HTMLElement new];
element.elementId = @"originalId";
HTMLElement *clone = [element cloneNodeDeep:YES];
NSString *cloneId = @"cloneId";
clone.elementId = cloneId;
XCTAssertTrue([clone.elementId isEqualToString:cloneId]);
}
@end