From db0bb51bc58f8d5d7e47e9ffd9cffcfba701e99f Mon Sep 17 00:00:00 2001 From: iska Date: Sat, 11 Apr 2015 00:36:37 +0200 Subject: [PATCH] Fix the "isindex" attributes handling in the "in body" insertion mode --- HTMLKit/HTMLParser.m | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/HTMLKit/HTMLParser.m b/HTMLKit/HTMLParser.m index f64fb87..55cb55f 100644 --- a/HTMLKit/HTMLParser.m +++ b/HTMLKit/HTMLParser.m @@ -1301,10 +1301,13 @@ NSString *prompt = token.attributes[@"prompt"] ?: @"This is a searchable index. Enter search keywords: "; [self insertCharacters:prompt]; - HTMLStartTagToken *inputToken = [[HTMLStartTagToken alloc] initWithTagName:@"input" attributes:token.attributes]; - inputToken.attributes[@"name"] = @"isindex"; - [inputToken.attributes removeObjectForKey:@"action"]; - [inputToken.attributes removeObjectForKey:@"prompt"]; + NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithDictionary:token.attributes]; + attributes[@"name"] = @"isindex"; + [attributes removeObjectForKey:@"action"]; + [attributes removeObjectForKey:@"prompt"]; + + HTMLStartTagToken *inputToken = [[HTMLStartTagToken alloc] initWithTagName:@"input" attributes:attributes]; + [self insertElementForToken:inputToken]; [_stackOfOpenElements popCurrentNode]; [_stackOfOpenElements popCurrentNode];