Add implementation for the length property for HTML Nodes

See:
https://dom.spec.whatwg.org/#concept-node-length
https://heycam.github.io/webidl/#dfn-code-unit
This commit is contained in:
iska
2016-11-20 18:36:55 +01:00
parent 46072a09cc
commit 2fb871a7ff
5 changed files with 37 additions and 0 deletions
+12
View File
@@ -137,6 +137,11 @@ typedef NS_ENUM(unsigned short, HTMLDocumentPosition)
*/
@property (nonatomic, copy) NSString *innerHTML;
/**
The length of the node as described in https://dom.spec.whatwg.org/#concept-node-length
*/
@property (nonatomic, assign) NSUInteger length;
/**
@abstract Use concrete subclasses of the HTML Node.
*/
@@ -164,6 +169,13 @@ typedef NS_ENUM(unsigned short, HTMLDocumentPosition)
*/
- (NSUInteger)childNodesCount;
/**
Checks whether the node is empty as described in https://dom.spec.whatwg.org/#concept-node-length
@return `YES` if the node is empty, `NO` otherwise.
*/
- (BOOL)isEmpty;
/**
Returns the child node at a given index.