Add initial stubs for HTML Document and Element nodes

https://dom.spec.whatwg.org/#interface-document
https://dom.spec.whatwg.org/#interface-element
This commit is contained in:
iska
2015-02-27 00:03:35 +01:00
parent 034a28deea
commit 83bca329ff
5 changed files with 78 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
//
// HTMLDocument.h
// HTMLKit
//
// Created by Iska on 25/02/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import "HTMLNode.h"
#import "HTMLDocumentType.h"
typedef NS_ENUM(short, HTMLQuirksMode)
{
HTMLQuirksModeNoQuirks,
HTMLQuirksModeQuirks,
HTMLQuirksModeLimitedQuirks
};
@interface HTMLDocument : HTMLNode
@property (nonatomic, strong) HTMLDocumentType *documentType;
@property (nonatomic, assign) HTMLQuirksMode quirksMode;
@property (nonatomic, copy, readonly) NSString *compatMode;
@end
+13
View File
@@ -0,0 +1,13 @@
//
// HTMLDocument.m
// HTMLKit
//
// Created by Iska on 25/02/15.
// Copyright (c) 2015 BrainCookie. All rights reserved.
//
#import "HTMLDocument.h"
@implementation HTMLDocument
@end
+8 -3
View File
@@ -8,11 +8,16 @@
#import <Foundation/Foundation.h>
#import "HTMLNamespaces.h"
#import "HTMLNode.h"
@interface HTMLElement : NSObject
@interface HTMLElement : HTMLNode
@property (nonatomic, strong, readonly) NSString *tagName;
@property (nonatomic, assign, readonly) HTMLNamespace namespace;
@property (nonatomic, strong, readonly) id parentNode;
@property (nonatomic, copy, readonly) NSString *tagName;
@property (nonatomic, copy) NSString *id;
@property (nonatomic, copy) NSString *className;
@end
+20
View File
@@ -10,4 +10,24 @@
@implementation HTMLElement
- (instancetype)init
{
return [self initWithTagName:nil];
}
- (instancetype)initWithTagName:(NSString *)tagName
{
self = [super initWithName:tagName type:HTMLNodeElement];
if (self) {
_tagName = tagName;
}
return self;
}
- (NSString *)textContent
{
#warning Implement Traversing
return nil;
}
@end