Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 118cb41971 | |||
| 3d9f2007ee | |||
| e79f96e217 | |||
| 3333274cfb | |||
| 26ee9e683f | |||
| 9e45ac5fa1 |
+1
-1
@@ -1,5 +1,5 @@
|
||||
module: HTMLKit
|
||||
module_version: 4.1.0
|
||||
module_version: 4.2.0
|
||||
author: Iskandar Abudiab
|
||||
author_url: https://twitter.com/iabudiab
|
||||
github_url: https://github.com/iabudiab/HTMLKit
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Change Log
|
||||
|
||||
## [4.2.0](https://github.com/iabudiab/HTMLKit/releases/tag/4.1.0)
|
||||
|
||||
- Fix test compilation under Xcode 12.5 (issue #43)
|
||||
- Updated HTML5Lib-Tests submodule (082a4be)
|
||||
- Updated parser and tokenizer for latest spec changes to pass test suite
|
||||
|
||||
## [4.1.0](https://github.com/iabudiab/HTMLKit/releases/tag/4.1.0)
|
||||
|
||||
- Updated project for Xcode 12.5
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "HTMLKit"
|
||||
s.version = "4.1.0"
|
||||
s.version = "4.2.0"
|
||||
s.summary = "HTMLKit, an Objective-C framework for your everyday HTML needs."
|
||||
s.license = "MIT"
|
||||
s.homepage = "https://github.com/iabudiab/HTMLKit"
|
||||
|
||||
@@ -2217,7 +2217,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@@ -2265,7 +2265,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
@@ -2291,7 +2291,7 @@
|
||||
INSTALL_PATH = "@rpath";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
TVOS_DEPLOYMENT_TARGET = 12.0;
|
||||
@@ -2321,7 +2321,7 @@
|
||||
INSTALL_PATH = "@rpath";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
TVOS_DEPLOYMENT_TARGET = 12.0;
|
||||
@@ -2402,7 +2402,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_MODULE_NAME = HTMLKit;
|
||||
@@ -2441,7 +2441,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_MODULE_NAME = HTMLKit;
|
||||
@@ -2482,7 +2482,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
@@ -2521,7 +2521,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
@@ -2603,7 +2603,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
@@ -2643,7 +2643,7 @@
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.iabudiab.HTMLKit;
|
||||
PRODUCT_NAME = HTMLKit;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# HTMLKit
|
||||
|
||||

|
||||

|
||||
|
||||
An Objective-C framework for your everyday HTML needs.
|
||||
|
||||
[](https://travis-ci.org/iabudiab/HTMLKit)
|
||||
[](https://codecov.io/gh/iabudiab/HTMLKit)
|
||||
[](https://github.com/iabudiab/HTMLKit/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/iabudiab/HTMLKit)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://cocoapods.org/pods/HTMLKit)
|
||||
[](http://cocoadocs.org/docsets/HTMLKit)
|
||||
[](http://cocoadocs.org/docsets/HTMLKit)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
@@ -77,7 +76,7 @@ To add `HTMLKit` as a dependency into your project using CocoaPods just add the
|
||||
|
||||
```ruby
|
||||
target 'MyTarget' do
|
||||
pod 'HTMLKit', '~> 4.1'
|
||||
pod 'HTMLKit', '~> 4.2'
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
+15
-19
@@ -1308,7 +1308,7 @@
|
||||
_framesetOkFlag = NO;
|
||||
} else if ([tagName isEqualToString:@"a"]) {
|
||||
HTMLElement *element = ^ HTMLElement * {
|
||||
for (HTMLElement *element in self->_listOfActiveFormattingElements.reverseObjectEnumerator) {
|
||||
for (HTMLElement *element in self->_listOfActiveFormattingElements.reverseObjectEnumerator) {
|
||||
if ([element isEqual:[HTMLMarker marker]]) return nil;
|
||||
if ([element.tagName isEqualToString:@"a"]) {
|
||||
return element;
|
||||
@@ -2513,13 +2513,13 @@
|
||||
[characters enumerateSubstringsInRange:NSMakeRange(0, characters.length)
|
||||
options:NSStringEnumerationByComposedCharacterSequences
|
||||
usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
|
||||
if ([substring isEqualToString:@"\uFFFD"]) {
|
||||
[self emitParseError:@"Unexpected Character (0x0000) in foreign content"];
|
||||
} else if (!substring.htmlkit_isHTMLWhitespaceString) {
|
||||
self->_framesetOkFlag = NO;
|
||||
}
|
||||
[self insertCharacters:substring];
|
||||
}];
|
||||
if ([substring isEqualToString:@"\uFFFD"]) {
|
||||
[self emitParseError:@"Unexpected Character (0x0000) in foreign content"];
|
||||
} else if (!substring.htmlkit_isHTMLWhitespaceString) {
|
||||
self->_framesetOkFlag = NO;
|
||||
}
|
||||
[self insertCharacters:substring];
|
||||
}];
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2541,23 +2541,19 @@
|
||||
}
|
||||
[self insertForeignElementForToken:token.asTagToken inNamespace:self.adjustedCurrentNode.htmlNamespace];
|
||||
if (token.asTagToken.selfClosing) {
|
||||
[self->_stackOfOpenElements popCurrentNode];
|
||||
[self->_stackOfOpenElements popCurrentNode];
|
||||
}
|
||||
};
|
||||
|
||||
void (^ matchedCase)(void) = ^ {
|
||||
[self emitParseError:@"Unexpected start tag <%@> in foreign content", token.asTagToken.tagName];
|
||||
if (self->_fragmentParsingAlgorithm) {
|
||||
anythingElse();
|
||||
} else {
|
||||
[self->_stackOfOpenElements popCurrentNode];
|
||||
while (!IsNodeMathMLTextIntegrationPoint(self.currentNode) &&
|
||||
!IsNodeHTMLIntegrationPoint(self.currentNode) &&
|
||||
self.currentNode.htmlNamespace != HTMLNamespaceHTML) {
|
||||
[self->_stackOfOpenElements popCurrentNode];
|
||||
}
|
||||
[self reprocessToken:token];
|
||||
|
||||
while (!IsNodeMathMLTextIntegrationPoint(self.currentNode) &&
|
||||
!IsNodeHTMLIntegrationPoint(self.currentNode) &&
|
||||
self.currentNode.htmlNamespace != HTMLNamespaceHTML) {
|
||||
[self->_stackOfOpenElements popCurrentNode];
|
||||
}
|
||||
[self processToken:token byApplyingRulesForInsertionMode:HTMLInsertionModeInBody];
|
||||
};
|
||||
|
||||
if ([token.asTagToken.tagName isEqualToAny:@"b", @"big", @"blockquote", @"body", @"br",
|
||||
|
||||
@@ -2413,6 +2413,7 @@
|
||||
usingComparator:^ NSComparisonResult (id obj1, id obj2) { return [obj1 compare:obj2]; }];
|
||||
|
||||
if (searchIndex >= entities.count || ![[entities objectAtIndex:searchIndex] hasPrefix:name]) {
|
||||
[name setString:[name substringToIndex:name.length -1]];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,64 +29,66 @@ NS_INLINE void AdjustSVGAttributes(HTMLTagToken *token)
|
||||
return;
|
||||
}
|
||||
|
||||
NSDictionary *replacements = @{@"attributename": @"attributeName",
|
||||
@"attributetype": @"attributeType",
|
||||
@"basefrequency": @"baseFrequency",
|
||||
@"baseprofile": @"baseProfile",
|
||||
@"calcmode": @"calcMode",
|
||||
@"clippathunits": @"clipPathUnits",
|
||||
@"diffuseconstant": @"diffuseConstant",
|
||||
@"edgemode": @"edgeMode",
|
||||
@"filterunits": @"filterUnits",
|
||||
@"glyphref": @"glyphRef",
|
||||
@"gradienttransform": @"gradientTransform",
|
||||
@"gradientunits": @"gradientUnits",
|
||||
@"kernelmatrix": @"kernelMatrix",
|
||||
@"kernelunitlength": @"kernelUnitLength",
|
||||
@"keypoints": @"keyPoints",
|
||||
@"keysplines": @"keySplines",
|
||||
@"keytimes": @"keyTimes",
|
||||
@"lengthadjust": @"lengthAdjust",
|
||||
@"limitingconeangle": @"limitingConeAngle",
|
||||
@"markerheight": @"markerHeight",
|
||||
@"markerunits": @"markerUnits",
|
||||
@"markerwidth": @"markerWidth",
|
||||
@"maskcontentunits": @"maskContentUnits",
|
||||
@"maskunits": @"maskUnits",
|
||||
@"numoctaves": @"numOctaves",
|
||||
@"pathlength": @"pathLength",
|
||||
@"patterncontentunits": @"patternContentUnits",
|
||||
@"patterntransform": @"patternTransform",
|
||||
@"patternunits": @"patternUnits",
|
||||
@"pointsatx": @"pointsAtX",
|
||||
@"pointsaty": @"pointsAtY",
|
||||
@"pointsatz": @"pointsAtZ",
|
||||
@"preservealpha": @"preserveAlpha",
|
||||
@"preserveaspectratio": @"preserveAspectRatio",
|
||||
@"primitiveunits": @"primitiveUnits",
|
||||
@"refx": @"refX",
|
||||
@"refy": @"refY",
|
||||
@"repeatcount": @"repeatCount",
|
||||
@"repeatdur": @"repeatDur",
|
||||
@"requiredextensions": @"requiredExtensions",
|
||||
@"requiredfeatures": @"requiredFeatures",
|
||||
@"specularconstant": @"specularConstant",
|
||||
@"specularexponent": @"specularExponent",
|
||||
@"spreadmethod": @"spreadMethod",
|
||||
@"startoffset": @"startOffset",
|
||||
@"stddeviation": @"stdDeviation",
|
||||
@"stitchtiles": @"stitchTiles",
|
||||
@"surfacescale": @"surfaceScale",
|
||||
@"systemlanguage": @"systemLanguage",
|
||||
@"tablevalues": @"tableValues",
|
||||
@"targetx": @"targetX",
|
||||
@"targety": @"targetY",
|
||||
@"textlength": @"textLength",
|
||||
@"viewbox": @"viewBox",
|
||||
@"viewtarget": @"viewTarget",
|
||||
@"xchannelselector": @"xChannelSelector",
|
||||
@"ychannelselector": @"yChannelSelector",
|
||||
@"zoomandpan": @"zoomAndPan"};
|
||||
NSDictionary *replacements = @{
|
||||
@"attributename": @"attributeName",
|
||||
@"attributetype": @"attributeType",
|
||||
@"basefrequency": @"baseFrequency",
|
||||
@"baseprofile": @"baseProfile",
|
||||
@"calcmode": @"calcMode",
|
||||
@"clippathunits": @"clipPathUnits",
|
||||
@"diffuseconstant": @"diffuseConstant",
|
||||
@"edgemode": @"edgeMode",
|
||||
@"filterunits": @"filterUnits",
|
||||
@"glyphref": @"glyphRef",
|
||||
@"gradienttransform": @"gradientTransform",
|
||||
@"gradientunits": @"gradientUnits",
|
||||
@"kernelmatrix": @"kernelMatrix",
|
||||
@"kernelunitlength": @"kernelUnitLength",
|
||||
@"keypoints": @"keyPoints",
|
||||
@"keysplines": @"keySplines",
|
||||
@"keytimes": @"keyTimes",
|
||||
@"lengthadjust": @"lengthAdjust",
|
||||
@"limitingconeangle": @"limitingConeAngle",
|
||||
@"markerheight": @"markerHeight",
|
||||
@"markerunits": @"markerUnits",
|
||||
@"markerwidth": @"markerWidth",
|
||||
@"maskcontentunits": @"maskContentUnits",
|
||||
@"maskunits": @"maskUnits",
|
||||
@"numoctaves": @"numOctaves",
|
||||
@"pathlength": @"pathLength",
|
||||
@"patterncontentunits": @"patternContentUnits",
|
||||
@"patterntransform": @"patternTransform",
|
||||
@"patternunits": @"patternUnits",
|
||||
@"pointsatx": @"pointsAtX",
|
||||
@"pointsaty": @"pointsAtY",
|
||||
@"pointsatz": @"pointsAtZ",
|
||||
@"preservealpha": @"preserveAlpha",
|
||||
@"preserveaspectratio": @"preserveAspectRatio",
|
||||
@"primitiveunits": @"primitiveUnits",
|
||||
@"refx": @"refX",
|
||||
@"refy": @"refY",
|
||||
@"repeatcount": @"repeatCount",
|
||||
@"repeatdur": @"repeatDur",
|
||||
@"requiredextensions": @"requiredExtensions",
|
||||
@"requiredfeatures": @"requiredFeatures",
|
||||
@"specularconstant": @"specularConstant",
|
||||
@"specularexponent": @"specularExponent",
|
||||
@"spreadmethod": @"spreadMethod",
|
||||
@"startoffset": @"startOffset",
|
||||
@"stddeviation": @"stdDeviation",
|
||||
@"stitchtiles": @"stitchTiles",
|
||||
@"surfacescale": @"surfaceScale",
|
||||
@"systemlanguage": @"systemLanguage",
|
||||
@"tablevalues": @"tableValues",
|
||||
@"targetx": @"targetX",
|
||||
@"targety": @"targetY",
|
||||
@"textlength": @"textLength",
|
||||
@"viewbox": @"viewBox",
|
||||
@"viewtarget": @"viewTarget",
|
||||
@"xchannelselector": @"xChannelSelector",
|
||||
@"ychannelselector": @"yChannelSelector",
|
||||
@"zoomandpan": @"zoomAndPan"
|
||||
};
|
||||
|
||||
HTMLOrderedDictionary *adjusted = [HTMLOrderedDictionary new];
|
||||
for (id key in token.attributes) {
|
||||
@@ -99,43 +101,44 @@ NS_INLINE void AdjustSVGAttributes(HTMLTagToken *token)
|
||||
NS_INLINE void AdjustSVGNameCase(HTMLTagToken *token)
|
||||
{
|
||||
NSDictionary *replacements = @{
|
||||
@"altglyph": @"altGlyph",
|
||||
@"altglyphdef": @"altGlyphDef",
|
||||
@"altglyphitem": @"altGlyphItem",
|
||||
@"animatecolor": @"animateColor",
|
||||
@"animatemotion": @"animateMotion",
|
||||
@"animatetransform": @"animateTransform",
|
||||
@"clippath": @"clipPath",
|
||||
@"feblend": @"feBlend",
|
||||
@"fecolormatrix": @"feColorMatrix",
|
||||
@"fecomponenttransfer": @"feComponentTransfer",
|
||||
@"fecomposite": @"feComposite",
|
||||
@"feconvolvematrix": @"feConvolveMatrix",
|
||||
@"fediffuselighting": @"feDiffuseLighting",
|
||||
@"fedisplacementmap": @"feDisplacementMap",
|
||||
@"fedistantlight": @"feDistantLight",
|
||||
@"fedropshadow": @"feDropShadow",
|
||||
@"feflood": @"feFlood",
|
||||
@"fefunca": @"feFuncA",
|
||||
@"fefuncb": @"feFuncB",
|
||||
@"fefuncg": @"feFuncG",
|
||||
@"fefuncr": @"feFuncR",
|
||||
@"fegaussianblur": @"feGaussianBlur",
|
||||
@"feimage": @"feImage",
|
||||
@"femerge": @"feMerge",
|
||||
@"femergenode": @"feMergeNode",
|
||||
@"femorphology": @"feMorphology",
|
||||
@"feoffset": @"feOffset",
|
||||
@"fepointlight": @"fePointLight",
|
||||
@"fespecularlighting": @"feSpecularLighting",
|
||||
@"fespotlight": @"feSpotLight",
|
||||
@"fetile": @"feTile",
|
||||
@"feturbulence": @"feTurbulence",
|
||||
@"foreignobject": @"foreignObject",
|
||||
@"glyphref": @"glyphRef",
|
||||
@"lineargradient": @"linearGradient",
|
||||
@"radialgradient": @"radialGradient",
|
||||
@"textpath": @"textPath"};
|
||||
@"altglyph": @"altGlyph",
|
||||
@"altglyphdef": @"altGlyphDef",
|
||||
@"altglyphitem": @"altGlyphItem",
|
||||
@"animatecolor": @"animateColor",
|
||||
@"animatemotion": @"animateMotion",
|
||||
@"animatetransform": @"animateTransform",
|
||||
@"clippath": @"clipPath",
|
||||
@"feblend": @"feBlend",
|
||||
@"fecolormatrix": @"feColorMatrix",
|
||||
@"fecomponenttransfer": @"feComponentTransfer",
|
||||
@"fecomposite": @"feComposite",
|
||||
@"feconvolvematrix": @"feConvolveMatrix",
|
||||
@"fediffuselighting": @"feDiffuseLighting",
|
||||
@"fedisplacementmap": @"feDisplacementMap",
|
||||
@"fedistantlight": @"feDistantLight",
|
||||
@"fedropshadow": @"feDropShadow",
|
||||
@"feflood": @"feFlood",
|
||||
@"fefunca": @"feFuncA",
|
||||
@"fefuncb": @"feFuncB",
|
||||
@"fefuncg": @"feFuncG",
|
||||
@"fefuncr": @"feFuncR",
|
||||
@"fegaussianblur": @"feGaussianBlur",
|
||||
@"feimage": @"feImage",
|
||||
@"femerge": @"feMerge",
|
||||
@"femergenode": @"feMergeNode",
|
||||
@"femorphology": @"feMorphology",
|
||||
@"feoffset": @"feOffset",
|
||||
@"fepointlight": @"fePointLight",
|
||||
@"fespecularlighting": @"feSpecularLighting",
|
||||
@"fespotlight": @"feSpotLight",
|
||||
@"fetile": @"feTile",
|
||||
@"feturbulence": @"feTurbulence",
|
||||
@"foreignobject": @"foreignObject",
|
||||
@"glyphref": @"glyphRef",
|
||||
@"lineargradient": @"linearGradient",
|
||||
@"radialgradient": @"radialGradient",
|
||||
@"textpath": @"textPath"
|
||||
};
|
||||
|
||||
NSString *replacement = replacements[token.tagName] ?: token.tagName;
|
||||
token.tagName = replacement;
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
[_cases addObject:_currentCase];
|
||||
}
|
||||
|
||||
- (void)testCase:(XCTestCase *)testCase didFailWithDescription:(NSString *)description inFile:(NSString *)filePath atLine:(NSUInteger)lineNumber
|
||||
- (void)testCase:(XCTestCase *)testCase didRecordIssue:(XCTIssue *)issue
|
||||
{
|
||||
_currentCase[@"status"] = @"Failed";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
parent = [HTMLDocumentFragment new];
|
||||
XCTAssertNoThrow([parent appendNode:element]);
|
||||
|
||||
parent = [HTMLElement new];
|
||||
parent = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
XCTAssertNoThrow([parent appendNode:element]);
|
||||
|
||||
parent = [HTMLTemplate new];
|
||||
@@ -54,7 +54,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
parent = [HTMLDocumentFragment new];
|
||||
XCTAssertNoThrow([parent insertNode:element beforeChildNode:nil]);
|
||||
|
||||
parent = [HTMLElement new];
|
||||
parent = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
XCTAssertNoThrow([parent insertNode:element beforeChildNode:nil]);
|
||||
|
||||
parent = [HTMLTemplate new];
|
||||
@@ -115,9 +115,9 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
|
||||
XCTAssertNoThrow([document appendNode:[HTMLDocumentFragment new]]);
|
||||
XCTAssertNoThrow([document appendNode:[HTMLDocumentType new]]);
|
||||
XCTAssertNoThrow([document appendNode:[HTMLElement new]]);
|
||||
XCTAssertNoThrow([document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]]);
|
||||
|
||||
HTMLElement *element = [HTMLElement new];
|
||||
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
|
||||
XCTAssertNoThrow([element appendNode:[HTMLTemplate new]]);
|
||||
XCTAssertNoThrow([element appendNode:[HTMLComment new]]);
|
||||
@@ -132,7 +132,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
|
||||
XCTAssertThrows([[HTMLDocumentFragment new] appendNode:doctype]);
|
||||
XCTAssertThrows([[HTMLDocumentType new] appendNode:doctype]);
|
||||
XCTAssertThrows([[HTMLElement new] appendNode:doctype]);
|
||||
XCTAssertThrows([[[HTMLElement alloc] initWithTagName:@"div"] appendNode:doctype]);
|
||||
XCTAssertThrows([[HTMLTemplate new] appendNode:doctype]);
|
||||
XCTAssertThrows([[HTMLComment new] appendNode:doctype]);
|
||||
XCTAssertThrows([[HTMLText new] appendNode:doctype]);
|
||||
@@ -148,7 +148,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
XCTAssertThrows([[HTMLText new] appendNode:text]);
|
||||
|
||||
XCTAssertNoThrow([[HTMLDocumentFragment new] appendNode:text]);
|
||||
XCTAssertNoThrow([[HTMLElement new] appendNode:text]);
|
||||
XCTAssertNoThrow([[[HTMLElement alloc] initWithTagName:@"div"] appendNode:text]);
|
||||
XCTAssertNoThrow([[HTMLTemplate new] appendNode:text]);
|
||||
}
|
||||
|
||||
@@ -172,8 +172,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* Fragment has more than one Element child
|
||||
*/
|
||||
reset();
|
||||
[fragment appendNode:[HTMLElement new]];
|
||||
[fragment appendNode:[HTMLElement new]];
|
||||
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document appendNode:fragment]);
|
||||
|
||||
|
||||
@@ -182,8 +182,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* Document has an Element child
|
||||
*/
|
||||
reset();
|
||||
[fragment appendNode:[HTMLElement new]];
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document appendNode:fragment]);
|
||||
|
||||
/**
|
||||
@@ -192,7 +192,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
*/
|
||||
reset();
|
||||
HTMLDocumentType *doctype = [HTMLDocumentType new];
|
||||
[fragment appendNode:[HTMLElement new]];
|
||||
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:doctype];
|
||||
XCTAssertThrows([document insertNode:fragment beforeChildNode:doctype]);
|
||||
|
||||
@@ -202,7 +202,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
*/
|
||||
reset();
|
||||
HTMLComment *doctypePreviousSibling = [HTMLComment new];
|
||||
[fragment appendNode:[HTMLElement new]];
|
||||
[fragment appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:doctypePreviousSibling];
|
||||
[document appendNode:doctype];
|
||||
XCTAssertThrows([document insertNode:fragment beforeChildNode:doctypePreviousSibling]);
|
||||
@@ -211,7 +211,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
- (void)testValidElementInsertionIntoDocument
|
||||
{
|
||||
HTMLDocument *document = [HTMLDocument new];
|
||||
HTMLElement *element = [HTMLElement new];
|
||||
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
|
||||
void (^ reset)(void) = ^ {
|
||||
[element removeAllChildNodes];
|
||||
@@ -221,7 +221,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
/**
|
||||
* Document has an Element child
|
||||
*/
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document appendNode:element]);
|
||||
|
||||
/**
|
||||
@@ -262,7 +262,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
*/
|
||||
reset();
|
||||
HTMLComment *secondChild = [HTMLComment new];
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:secondChild];
|
||||
XCTAssertThrows([document insertNode:doctype beforeChildNode:secondChild]);
|
||||
|
||||
@@ -270,7 +270,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* Document has an Element child
|
||||
*/
|
||||
reset();
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document appendNode:doctype]);
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* Replacement Fragment has more than one Element child
|
||||
*/
|
||||
reset();
|
||||
[replacement appendNode:[HTMLElement new]];
|
||||
[replacement appendNode:[HTMLElement new]];
|
||||
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
|
||||
|
||||
/**
|
||||
@@ -305,8 +305,8 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* Document has an Element child that is not the Replacement
|
||||
*/
|
||||
reset();
|
||||
[replacement appendNode:[HTMLElement new]];
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
|
||||
|
||||
/**
|
||||
@@ -315,7 +315,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
*/
|
||||
reset();
|
||||
HTMLDocumentType *doctype = [HTMLDocumentType new];
|
||||
[replacement appendNode:[HTMLElement new]];
|
||||
[replacement appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
[document appendNode:doctype];
|
||||
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
{
|
||||
HTMLDocument *document = [HTMLDocument new];
|
||||
HTMLComment *child = [HTMLComment new];
|
||||
HTMLElement *replacement = [HTMLElement new];
|
||||
HTMLElement *replacement = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
|
||||
void (^ reset)(void) = ^ {
|
||||
[replacement removeAllChildNodes];
|
||||
@@ -335,7 +335,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
/**
|
||||
* Docment has an Element child that is not replacement
|
||||
*/
|
||||
[document appendNode:[HTMLElement new]];
|
||||
[document appendNode:[[HTMLElement alloc] initWithTagName:@"div"]];
|
||||
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
|
||||
|
||||
/**
|
||||
@@ -369,7 +369,7 @@ extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
|
||||
* An Element is preceding the child node
|
||||
*/
|
||||
reset();
|
||||
[document insertNode:[HTMLElement new] beforeChildNode:child];
|
||||
[document insertNode:[[HTMLElement alloc] initWithTagName:@"div"] beforeChildNode:child];
|
||||
XCTAssertThrows([document replaceChildNode:child withNode:replacement]);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
XCTAssertEqual(element.childNodesCount, 1);
|
||||
XCTAssertEqual(element.firstChild, comment);
|
||||
|
||||
HTMLElement *firstElement = [HTMLElement new];
|
||||
HTMLElement *secondElement = [HTMLElement new];
|
||||
HTMLElement *firstElement = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
HTMLElement *secondElement = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
NSArray *nodes = @[firstElement, secondElement];
|
||||
|
||||
[element appendNodes:nodes];
|
||||
@@ -76,8 +76,8 @@
|
||||
XCTAssertEqual(element.childNodesCount, 2);
|
||||
XCTAssertEqual(element.firstChild, comment);
|
||||
|
||||
HTMLElement *firstElement = [HTMLElement new];
|
||||
HTMLElement *secondElement = [HTMLElement new];
|
||||
HTMLElement *firstElement = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
HTMLElement *secondElement = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
NSArray *nodes = @[firstElement, secondElement];
|
||||
|
||||
[element prependNodes:nodes];
|
||||
@@ -94,8 +94,8 @@
|
||||
[element appendNode:comment];
|
||||
|
||||
HTMLDocumentFragment *fragment = [HTMLDocumentFragment new];
|
||||
HTMLElement *firstChild = [HTMLElement new];
|
||||
HTMLElement *secondChild = [HTMLElement new];
|
||||
HTMLElement *firstChild = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
HTMLElement *secondChild = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
[fragment appendNode:firstChild];
|
||||
[fragment appendNode:secondChild];
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
|
||||
XCTAssertTrue([paragraph compareDocumentPositionWithNode:paragraph] == HTMLDocumentPositionEquivalent);
|
||||
|
||||
HTMLElement *element = [HTMLElement new];
|
||||
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
XCTAssertTrue([paragraph compareDocumentPositionWithNode:element] == HTMLDocumentPositionPreceding);
|
||||
|
||||
XCTAssertTrue([paragraph compareDocumentPositionWithNode:image] == HTMLDocumentPositionPreceding);
|
||||
@@ -556,7 +556,7 @@
|
||||
#pragma mark - Bug Fixes
|
||||
|
||||
- (void)testBugFix_Issue_20 {
|
||||
HTMLElement *element = [HTMLElement new];
|
||||
HTMLElement *element = [[HTMLElement alloc] initWithTagName:@"div"];
|
||||
element.elementId = @"originalId";
|
||||
|
||||
HTMLElement *clone = [element cloneNodeDeep:YES];
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
{
|
||||
HTMLRange *range = [[HTMLRange alloc] initWithDocument:_document];
|
||||
|
||||
XCTAssertThrows([range setStartNode:[HTMLElement new] startOffset:0], @"Cannot set boundary to a node outside of the range's document");
|
||||
XCTAssertThrows([range setStartNode:[[HTMLElement alloc] initWithTagName:@"div"] startOffset:0], @"Cannot set boundary to a node outside of the range's document");
|
||||
XCTAssertThrows([range setStartNode:[HTMLDocumentType new] startOffset:0], @"DOCTYPE as range boundary is invalid");
|
||||
XCTAssertThrows([range setStartNode:_firstText startOffset:_firstText.length + 1], @"Offset is outside the boundary node");
|
||||
|
||||
|
||||
+1
-1
Submodule Tests/html5lib-tests updated: e52ff68cc7...082a4be911
Reference in New Issue
Block a user