8 Commits

Author SHA1 Message Date
iska bf0d8560b0 Merge branch 'release/2.1.4' 2018-05-01 20:08:30 +02:00
iska d29a70dfec Bump HTMLKit version to 2.1.4 2018-05-01 20:08:00 +02:00
iska b8f56ca97d Update podspec for 2.1.4 2018-05-01 20:07:44 +02:00
iska 0f954d5d56 Update jazzy.yaml for 2.1.4 2018-05-01 20:07:35 +02:00
iska ac5089d69b Add Changelog entry for HTMLKit 2.1.4 2018-05-01 20:07:23 +02:00
iska c9c36397e0 Update CocoaPods block in Readme 2018-05-01 20:02:36 +02:00
iska 923e271429 Fix eq, lt & gt selectors for the zero-index case
Fixes #25
2018-04-18 23:51:39 +02:00
iska da765169fa Merge branch 'release/2.1.3' into develop 2018-03-21 22:51:46 +01:00
8 changed files with 65 additions and 9 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
module: HTMLKit
module_version: 2.1.3
module_version: 2.1.4
author: Iskandar Abudiab
author_url: https://twitter.com/iabudiab
github_url: https://github.com/iabudiab/HTMLKit
+9
View File
@@ -1,5 +1,14 @@
# Change Log
## [2.1.4](https://github.com/iabudiab/HTMLKit/releases/tag/2.1.4)
Released on 2018.05.01
### Fixes
- `gt(n)`, `lt(n)` and `eq(n)` selectors would select wrong elements for the zero-index (issue #25)
## [2.1.3](https://github.com/iabudiab/HTMLKit/releases/tag/2.1.3)
Released on 2018.03.21
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "HTMLKit"
s.version = "2.1.3"
s.version = "2.1.4"
s.summary = "HTMLKit, an Objective-C framework for your everyday HTML needs."
s.license = "MIT"
s.homepage = "https://github.com/iabudiab/HTMLKit"
+8
View File
@@ -11,6 +11,9 @@
62056C501E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 62056C4E1E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
62056C511E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 62056C4E1E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
62056C521E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 62056C4E1E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
620AB7B12087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */ = {isa = PBXBuildFile; fileRef = 620AB7B02087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m */; };
620AB7B22087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */ = {isa = PBXBuildFile; fileRef = 620AB7B02087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m */; };
620AB7B32087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */ = {isa = PBXBuildFile; fileRef = 620AB7B02087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m */; };
62132E5A1C01F83200084175 /* CSSSelectorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 62132E581C01F83200084175 /* CSSSelectorTest.m */; };
62132E5D1C021FF200084175 /* css-tests in Resources */ = {isa = PBXBuildFile; fileRef = 62132E5B1C021FF200084175 /* css-tests */; };
6216ACFD1C28DCC80074CAB4 /* CSSExtensionSelectorsParsingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6216ACFC1C28DCC80074CAB4 /* CSSExtensionSelectorsParsingTests.m */; };
@@ -584,6 +587,7 @@
/* Begin PBXFileReference section */
62056C4E1E2AD9FB009A4EE0 /* HTMLNodeIterator+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "HTMLNodeIterator+Private.h"; path = "include/HTMLNodeIterator+Private.h"; sourceTree = "<group>"; };
62079BE71AF56F1E00D3B402 /* CSSSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSSelector.h; path = include/CSSSelector.h; sourceTree = "<group>"; };
620AB7B02087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CSSStructuralPseudoSelectors.m; path = HTMLKitTests/CSSStructuralPseudoSelectors.m; sourceTree = "<group>"; };
620C87791BD44CBE00FB3EEE /* CSSCompoundSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSCompoundSelector.h; path = include/CSSCompoundSelector.h; sourceTree = "<group>"; };
620C877A1BD44CBE00FB3EEE /* CSSCompoundSelector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSSCompoundSelector.m; sourceTree = "<group>"; };
620EE9471BC46F2A0028ED34 /* CSSPseudoClassSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSPseudoClassSelector.h; path = include/CSSPseudoClassSelector.h; sourceTree = "<group>"; };
@@ -1144,6 +1148,7 @@
624AB3191B050A4D00F3830D /* CSSAttributeSelectorTests.m */,
62F6586F1BD83C8E0045F137 /* CSSNThExpressionSelectorTests.m */,
621FBE5C1BDAD90200BC9555 /* CSSCombinatorSelectorTests.m */,
620AB7B02087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m */,
);
name = Selectors;
sourceTree = "<group>";
@@ -1750,6 +1755,7 @@
buildActionMask = 2147483647;
files = (
62EC0A851E158BD80007786B /* HTMLRangeTests.m in Sources */,
620AB7B12087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */,
62E0BA971E25456700E4D193 /* HTMLCharacterDataTests.m in Sources */,
6216ACFD1C28DCC80074CAB4 /* CSSExtensionSelectorsParsingTests.m in Sources */,
62132E5A1C01F83200084175 /* CSSSelectorTest.m in Sources */,
@@ -1893,6 +1899,7 @@
buildActionMask = 2147483647;
files = (
62EC0A871E158BD80007786B /* HTMLRangeTests.m in Sources */,
620AB7B32087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */,
62E0BA991E25456700E4D193 /* HTMLCharacterDataTests.m in Sources */,
62857D3B1D39A345008DC254 /* CSSSelectorTest.m in Sources */,
62857D421D39A345008DC254 /* CSSCombinatorSelectorTests.m in Sources */,
@@ -1981,6 +1988,7 @@
buildActionMask = 2147483647;
files = (
62EC0A861E158BD80007786B /* HTMLRangeTests.m in Sources */,
620AB7B22087F18D00AFCCC7 /* CSSStructuralPseudoSelectors.m in Sources */,
62E0BA981E25456700E4D193 /* HTMLCharacterDataTests.m in Sources */,
6216ACFE1C28DCC80074CAB4 /* CSSExtensionSelectorsParsingTests.m in Sources */,
62ECBFCA1C0B6E2E00AF847B /* HTML5LibTokenizerTest.m in Sources */,
+1 -3
View File
@@ -76,10 +76,8 @@ $ gem install cocoapods
To add `HTMLKit` as a dependency into your project using CocoaPods just add the following in your `Podfile`:
```ruby
use_frameworks!
target 'MyTarget' do
pod 'HTMLKit', '~> 2.0'
pod 'HTMLKit', '~> 2.1'
end
```
+3 -3
View File
@@ -276,7 +276,7 @@ CSSSelector * ltSelector(NSInteger index)
return namedBlockSelector(name, ^BOOL(HTMLElement * _Nonnull element) {
NSUInteger elementIndex = [element.parentElement indexOfChildNode:element];
if (index > 0) {
if (index >= 0) {
return elementIndex < index;
} else {
return elementIndex < element.parentElement.childNodesCount - index - 1;
@@ -290,7 +290,7 @@ CSSSelector * gtSelector(NSInteger index)
return namedBlockSelector(name, ^BOOL(HTMLElement * _Nonnull element) {
NSUInteger elementIndex = [element.parentElement indexOfChildNode:element];
if (index > 0) {
if (index >= 0) {
return elementIndex > index;
} else {
return elementIndex > element.parentElement.childNodesCount - index - 1;
@@ -304,7 +304,7 @@ CSSSelector * eqSelector(NSInteger index)
return namedBlockSelector(name, ^BOOL(HTMLElement * _Nonnull element) {
NSUInteger elementIndex = [element.parentElement indexOfChildNode:element];
if (index > 0) {
if (index >= 0) {
return elementIndex == index;
} else {
return elementIndex == element.parentElement.childNodesCount - index - 1;
+1 -1
View File
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1.3</string>
<string>2.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
@@ -0,0 +1,41 @@
//
// CSSStructuralPseudoSelectors.m
// HTMLKit
//
// Created by Iska on 18.04.18.
// Copyright © 2018 BrainCookie. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "CSSSelectors.h"
#import "HTMLParser.h"
#import "HTMLDOM.h"
@interface CSSStructuralPseudoSelectors : XCTestCase
@end
@implementation CSSStructuralPseudoSelectors
#pragma mark - Bug Fixes
- (void)testBugFix_Issue_25
{
NSString *html = @"<table><tr><td>TD #0</td><td>TD #1</td><td>TD #2</td><td>TD #3</td></tr></table>";
HTMLDocument *doc = [HTMLDocument documentWithString:html];
NSArray<HTMLElement *> *elements = [doc querySelectorAll:@"td:gt(0)"];
XCTAssertEqual(elements.count, 3);
XCTAssertEqualObjects(elements[0].textContent, @"TD #1");
XCTAssertEqualObjects(elements[1].textContent, @"TD #2");
XCTAssertEqualObjects(elements[2].textContent, @"TD #3");
elements = [doc querySelectorAll:@"td:lt(0)"];
XCTAssertEqual(elements.count, 0);
elements = [doc querySelectorAll:@"td:eq(0)"];
XCTAssertEqual(elements.count, 1);
XCTAssertEqualObjects(elements[0].textContent, @"TD #0");
}
@end