File tree 1 file changed +15
-6
lines changed 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -588,18 +588,27 @@ - (BOOL)runAdoptionAgencyAlgorithmForTagName:(NSString *)tagName
588
588
HTMLElement *lastNode = furthestBlock;
589
589
590
590
NSUInteger index = [_stackOfOpenElements indexOfElement: node];
591
- for (int innerLoopCounter = 0 ; innerLoopCounter < 3 ; innerLoopCounter ++) {
592
591
593
- index --;
592
+ int innerLoopCounter = 0 ;
593
+ while (YES ) {
594
+
595
+ innerLoopCounter += 1 ;
596
+ index -= 1 ;
597
+
594
598
node = _stackOfOpenElements[index ];
595
599
596
- if (![_listOfActiveFormattingElements containsElement: node]) {
597
- [_stackOfOpenElements removeElement: node];
600
+ if ([node isEqual: formattingElement]) {
601
+ break ;
602
+ }
603
+
604
+ if (innerLoopCounter > 3 && [_listOfActiveFormattingElements containsElement: node]) {
605
+ [_listOfActiveFormattingElements removeElement: node];
598
606
continue ;
599
607
}
600
608
601
- if ([node isEqual: formattingElement]) {
602
- break ;
609
+ if (![_listOfActiveFormattingElements containsElement: node]) {
610
+ [_stackOfOpenElements removeElement: node];
611
+ continue ;
603
612
}
604
613
605
614
HTMLElement *newElement = [node copy ];
You can’t perform that action at this time.
0 commit comments