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:
@@ -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
|
||||
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user