diff --git a/HTMLKit/HTMLElement.h b/HTMLKit/HTMLElement.h
index ea0f15e..499c855 100644
--- a/HTMLKit/HTMLElement.h
+++ b/HTMLKit/HTMLElement.h
@@ -23,7 +23,7 @@
@property (nonatomic, copy) NSString *className;
- (instancetype)initWithTagName:(NSString *)tagName;
-- (instancetype)initWithTagName:(NSString *)tagName attributes:(id)attributes;
-- (instancetype)initWithTagName:(NSString *)tagName attributes:(id)attributes namespace:(HTMLNamespace)namespace;
+- (instancetype)initWithTagName:(NSString *)tagName attributes:(NSDictionary *)attributes;
+- (instancetype)initWithTagName:(NSString *)tagName attributes:(NSDictionary *)attributes namespace:(HTMLNamespace)namespace;
@end
diff --git a/HTMLKit/HTMLElement.m b/HTMLKit/HTMLElement.m
index e3d2a61..1c9ff5a 100644
--- a/HTMLKit/HTMLElement.m
+++ b/HTMLKit/HTMLElement.m
@@ -7,6 +7,13 @@
//
#import "HTMLElement.h"
+#import "HTMLOrderedDictionary.h"
+
+@interface HTMLElement ()
+{
+ HTMLOrderedDictionary *_attributes;
+}
+@end
@implementation HTMLElement
@@ -20,17 +27,20 @@
return [self initWithTagName:tagName attributes:nil];
}
-- (instancetype)initWithTagName:(NSString *)tagName attributes:(id)attributes
+- (instancetype)initWithTagName:(NSString *)tagName attributes:(NSDictionary *)attributes
{
return [self initWithTagName:tagName attributes:attributes namespace:HTMLNamespaceHTML];
}
-- (instancetype)initWithTagName:(NSString *)tagName attributes:(id)attributes namespace:(HTMLNamespace)namespace
+- (instancetype)initWithTagName:(NSString *)tagName attributes:(NSDictionary *)attributes namespace:(HTMLNamespace)namespace
{
self = [super initWithName:tagName type:HTMLNodeElement];
if (self) {
_tagName = tagName;
-#warning Attributes
+ _attributes = [HTMLOrderedDictionary new];
+ if (attributes != nil) {
+ [_attributes addEntriesFromDictionary:attributes];
+ }
_namespace = namespace;
}
return self;