Skip to content

Commit e4ae6fa

Browse files
committed
Per spec, only foster incoming nodes if current node is a table foster target
1 parent 41932fe commit e4ae6fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/jsoup/parser/HtmlTreeBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.jsoup.nodes.FormElement;
1111
import org.jsoup.nodes.Node;
1212
import org.jsoup.nodes.TextNode;
13-
import org.jsoup.select.Elements;
1413

1514
import javax.annotation.Nullable;
1615
import javax.annotation.ParametersAreNonnullByDefault;
@@ -20,6 +19,7 @@
2019
import java.util.List;
2120

2221
import static org.jsoup.internal.StringUtil.inSorted;
22+
import static org.jsoup.parser.HtmlTreeBuilderState.Constants.InTableFoster;
2323

2424
/**
2525
* HTML Tree Builder; creates a DOM from Tokens.
@@ -315,7 +315,7 @@ private void insertNode(Node node) {
315315
// if the stack hasn't been set up yet, elements (doctype, comments) go into the doc
316316
if (stack.isEmpty())
317317
doc.appendChild(node);
318-
else if (isFosterInserts())
318+
else if (isFosterInserts() && StringUtil.inSorted(currentElement().normalName(), InTableFoster))
319319
insertInFosterParent(node);
320320
else
321321
currentElement().appendChild(node);

0 commit comments

Comments
 (0)