14 Commits

Author SHA1 Message Date
iska 8546168324 Merge branch 'release/2.1.3' 2018-03-21 22:52:09 +01:00
iska ec6d03ee57 Bump HTMLKit version to 2.1.3 2018-03-21 22:43:01 +01:00
iska 7944549bd7 Update podspec for 2.1.3 2018-03-21 22:42:41 +01:00
iska bb6a97984b Update jazzy.yaml for 2.1.3 2018-03-21 22:42:32 +01:00
iska 0aff9cf787 Add Changelog entry for HTMLKit 2.1.3 2018-03-21 22:42:00 +01:00
iska b7bf9d2b04 Use HTMLOrderedDictionary when cloning element's attributes 2018-03-21 22:19:24 +01:00
iska 12af838fa2 Update html5lib-tests to latest commit as of 2018.03.18 2018-03-18 21:45:44 +01:00
iska 14b8b5390f Add test case for node deep-clone 2018-03-18 21:45:04 +01:00
Iskandar Abudiab a5599c4163 Merge pull request #23 from CRivlaldo/iterator
Fix the issue #22
2018-03-18 21:26:27 +01:00
Iskandar Abudiab c0ac25645d Merge pull request #24 from CRivlaldo/deepclone
Fix the issue #20
2018-03-18 21:19:42 +01:00
Vladimir fa431550d7 Fix the issue 22 (fix a test name) 2018-03-17 11:34:22 +03:00
Vladimir 70c6aee814 Fix the issue 22 2018-03-17 11:33:30 +03:00
Vladimir 7309b97b92 Fix the HTMLElement attributes copying 2018-03-17 10:40:00 +03:00
iska 7ffb8e5ca0 Merge branch 'release/2.1.2' into develop 2017-11-06 22:05:08 +01:00
11 changed files with 99 additions and 6 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
module: HTMLKit
module_version: 2.1.2
module_version: 2.1.3
author: Iskandar Abudiab
author_url: https://twitter.com/iabudiab
github_url: https://github.com/iabudiab/HTMLKit
+12
View File
@@ -1,5 +1,17 @@
# Change Log
## [2.1.3](https://github.com/iabudiab/HTMLKit/releases/tag/2.1.3)
Released on 2018.03.21
### Fixes
- `HTMLElement` clone would return an immutable dictionary for attributes (issue #20)
- Fixed by @CRivlaldo in PR #24
- `HTMLNodeFilterBlock` would behave differently on simulator and device (issue #22)
- Fixed by @CRivlaldo in PR #23
## [2.1.2](https://github.com/iabudiab/HTMLKit/releases/tag/2.1.2)
Released on 2017.11.6
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "HTMLKit"
s.version = "2.1.2"
s.version = "2.1.3"
s.summary = "HTMLKit, an Objective-C framework for your everyday HTML needs."
s.license = "MIT"
s.homepage = "https://github.com/iabudiab/HTMLKit"
+1 -1
View File
@@ -144,7 +144,7 @@
{
HTMLElement *copy = [super copyWithZone:zone];
copy->_tagName = [_tagName copy];
copy->_attributes = [_attributes copy];
copy->_attributes = [_attributes mutableCopy];
copy->_htmlNamespace = _htmlNamespace;
return copy;
}
+1 -1
View File
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.1.2</string>
<string>2.1.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+1 -1
View File
@@ -15,7 +15,7 @@
@interface HTMLNodeFilterBlock ()
{
BOOL (^ _block)(HTMLNode *);
HTMLNodeFilterValue (^ _block)(HTMLNode *);
}
@end
+7
View File
@@ -154,4 +154,11 @@
return [_keys countByEnumeratingWithState:state objects:buffer count:len];
}
#pragma mark - Copying
- (id)mutableCopy
{
return [[HTMLOrderedDictionary alloc] initWithDictionary:self];
}
@end
+2
View File
@@ -24,3 +24,5 @@
#import "HTMLKitDOMExceptions.h"
#import "HTMLNamespaces.h"
#import "HTMLQuirksMode.h"
#import "HTMLOrderedDictionary.h"
@@ -592,4 +592,20 @@ static HTMLNode * (^ LastDescendant)(HTMLNode *) = ^ HTMLNode * (HTMLNode *node)
XCTAssertEqual(0, nodeIterators.count);
}
- (void)testBugFix_Issue_22 {
// The issue is applicable only for devices. On simulator the test is passed.
HTMLDocument *document = [HTMLDocument documentWithString:@"<div id=\"id\"></div>"];
NSString *divId = @"id";
HTMLNodeFilterBlock *filter = [HTMLNodeFilterBlock filterWithBlock:^HTMLNodeFilterValue(HTMLNode * _Nonnull node) {
HTMLElement *element = (HTMLElement *)node;
return [element.elementId isEqualToString:divId] ? HTMLNodeFilterAccept : HTMLNodeFilterSkip;
}];
HTMLNodeIterator *iterator = [document nodeIteratorWithShowOptions:HTMLNodeFilterShowElement filter:filter];
HTMLElement *element = (HTMLElement*)iterator.nextObject;
XCTAssertTrue([element.elementId isEqualToString:divId]);
}
@end
+56
View File
@@ -512,4 +512,60 @@
XCTAssertTrue([image compareDocumentPositionWithNode:outerDiv] == (HTMLDocumentPositionContainedBy | HTMLDocumentPositionFollowing));
}
- (void)testDeepCloneElement {
HTMLElement *outer = [[HTMLElement alloc] initWithTagName:@"div"
attributes:@{@"id": @"outer",
@"class": @"green"}];
HTMLElement *innerLevel1 = [[HTMLElement alloc] initWithTagName:@"div"
attributes:@{@"id": @"inner1",
@"class": @"red"}];
HTMLElement *innerLevel2 = [[HTMLElement alloc] initWithTagName:@"div"
attributes:@{@"id": @"inner2",
@"class": @"red"}];
[outer appendNode:innerLevel1];
[innerLevel1 appendNode:innerLevel2];
HTMLElement *clone = [outer cloneNodeDeep:YES];
XCTAssertNotEqual(clone, outer);
XCTAssertEqualObjects(clone.elementId, outer.elementId);
XCTAssertEqualObjects(clone.attributes, outer.attributes);
XCTAssertNotEqual(clone.firstChild, innerLevel1);
XCTAssertEqualObjects(clone.firstChild.asElement.elementId, innerLevel1.elementId);
XCTAssertEqualObjects(clone.firstChild.asElement.attributes, innerLevel1.attributes);
XCTAssertNotEqual(clone.firstChild, innerLevel2);
XCTAssertEqualObjects(clone.firstChild.firstChild.asElement.elementId, innerLevel2.elementId);
XCTAssertEqualObjects(clone.firstChild.firstChild.asElement.attributes, innerLevel2.attributes);
}
- (void)testDeepCloneElementAttributes {
HTMLElement *div = [[HTMLElement alloc] initWithTagName:@"div"
attributes:@{@"id": @"outer",
@"class": @"green",
@"data": @"test"}];
HTMLElement *clone = [div cloneNodeDeep:YES];
XCTAssertEqualObjects(clone.attributes, div.attributes);
XCTAssertTrue([clone.attributes isKindOfClass:[HTMLOrderedDictionary class]]);
}
#pragma mark - Bug Fixes
- (void)testBugFix_Issue_20 {
HTMLElement *element = [HTMLElement new];
element.elementId = @"originalId";
HTMLElement *clone = [element cloneNodeDeep:YES];
NSString *cloneId = @"cloneId";
clone.elementId = cloneId;
XCTAssertTrue([clone.elementId isEqualToString:cloneId]);
}
@end