diff --git a/Sources/HTMLOrderedDictionary.m b/Sources/HTMLOrderedDictionary.m
index 8cc03e5..b458b40 100644
--- a/Sources/HTMLOrderedDictionary.m
+++ b/Sources/HTMLOrderedDictionary.m
@@ -154,4 +154,11 @@
return [_keys countByEnumeratingWithState:state objects:buffer count:len];
}
+#pragma mark - Copying
+
+- (id)mutableCopy
+{
+ return [[HTMLOrderedDictionary alloc] initWithDictionary:self];
+}
+
@end
diff --git a/Sources/include/HTMLDOM.h b/Sources/include/HTMLDOM.h
index 567062b..336db72 100644
--- a/Sources/include/HTMLDOM.h
+++ b/Sources/include/HTMLDOM.h
@@ -24,3 +24,5 @@
#import "HTMLKitDOMExceptions.h"
#import "HTMLNamespaces.h"
#import "HTMLQuirksMode.h"
+
+#import "HTMLOrderedDictionary.h"
diff --git a/Tests/HTMLKitTests/HTMLNodesTests.m b/Tests/HTMLKitTests/HTMLNodesTests.m
index 7461965..94aeda2 100644
--- a/Tests/HTMLKitTests/HTMLNodesTests.m
+++ b/Tests/HTMLKitTests/HTMLNodesTests.m
@@ -543,6 +543,18 @@
XCTAssertEqualObjects(clone.firstChild.firstChild.asElement.attributes, innerLevel2.attributes);
}
+- (void)testDeepCloneElementAttributes {
+ HTMLElement *div = [[HTMLElement alloc] initWithTagName:@"div"
+ attributes:@{@"id": @"outer",
+ @"class": @"green",
+ @"data": @"test"}];
+
+ HTMLElement *clone = [div cloneNodeDeep:YES];
+
+ XCTAssertEqualObjects(clone.attributes, div.attributes);
+ XCTAssertTrue([clone.attributes isKindOfClass:[HTMLOrderedDictionary class]]);
+}
+
#pragma mark - Bug Fixes
- (void)testBugFix_Issue_20 {