Add a NO_DOM_CHECKS macro to disable validations for DOM manipulations
DOM validation checks are expensive. This macro would allow for removing these checks from the compiled product, which would increase performance by about 20-30%. However, the user is responsible for the validity of the manipulations and the resulting DOM.
This commit is contained in:
@@ -153,7 +153,9 @@
|
||||
|
||||
- (HTMLNode *)insertNode:(HTMLNode *)node beforeChildNode:(HTMLNode *)child
|
||||
{
|
||||
#ifndef HTMLKIT_NO_DOM_CHECKS
|
||||
[self ensurePreInsertionValidityOfNode:node beforeChildNode:child];
|
||||
#endif
|
||||
|
||||
[self.ownerDocument adoptNode:node];
|
||||
|
||||
@@ -178,7 +180,9 @@
|
||||
|
||||
- (HTMLNode *)replaceChildNode:(HTMLNode *)child withNode:(HTMLNode *)node
|
||||
{
|
||||
#ifndef HTMLKIT_NO_DOM_CHECKS
|
||||
[self ensureReplacementValidityOfChildNode:child withNode:node];
|
||||
#endif
|
||||
|
||||
[self insertNode:node beforeChildNode:child];
|
||||
[child removeFromParentNode];
|
||||
@@ -269,6 +273,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HTMLKIT_NO_DOM_CHECKS
|
||||
|
||||
#pragma mark - Validity Checks
|
||||
|
||||
@@ -431,6 +436,8 @@ NS_INLINE void CheckInvalidCombination(HTMLNode *parent, HTMLNode *node, NSStrin
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#pragma mark - NSCopying
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
|
||||
Reference in New Issue
Block a user