@@ -29,6 +29,7 @@ public class Parser {
2929 private final boolean transformEntities ;
3030 private final boolean disableIgnoreTokenInBodyStartTag ;
3131 private final boolean interpretSelfClosingAnythingElse ;
32+ private final boolean disableInTableTextForsterParenting ;
3233
3334 /**
3435 * Instantiate a parser with the default configuration.
@@ -42,6 +43,7 @@ public Parser() {
4243 transformEntities = true ;
4344 disableIgnoreTokenInBodyStartTag = false ;
4445 interpretSelfClosingAnythingElse = false ;
46+ disableInTableTextForsterParenting = false ;
4547 }
4648
4749 /**
@@ -52,6 +54,7 @@ public Parser() {
5254 * <li>{@link Option#DONT_TRANSFORM_ENTITIES}</li>
5355 * <li>{@link Option#DISABLE_IGNORE_TOKEN_IN_BODY_START_TAG}</li>
5456 * <li>{@link Option#INTERPRET_SELF_CLOSING_ANYTHING_ELSE}</li>
57+ * <li>{@link Option#DISABLE_IN_TABLE_TEXT_FOSTER_PARENTING}</li>
5558 * </ul>
5659 *
5760 * @param options
@@ -61,6 +64,7 @@ public Parser(Set<Option> options) {
6164 this .transformEntities = !options .contains (Option .DONT_TRANSFORM_ENTITIES );
6265 this .disableIgnoreTokenInBodyStartTag = options .contains (Option .DISABLE_IGNORE_TOKEN_IN_BODY_START_TAG );
6366 this .interpretSelfClosingAnythingElse = options .contains (Option .INTERPRET_SELF_CLOSING_ANYTHING_ELSE );
67+ this .disableInTableTextForsterParenting = options .contains (Option .DISABLE_IN_TABLE_TEXT_FOSTER_PARENTING );
6468 }
6569
6670 /**
@@ -115,7 +119,7 @@ private List<Node> parseFragment(ProcessedInputStream is, Element node) {
115119
116120 // 1 when creating a tree constructor, a document is automatically
117121 // created (good idea? y/n?)
118- TreeConstructor tokenHandler = new TreeConstructor (disableIgnoreTokenInBodyStartTag , interpretSelfClosingAnythingElse );
122+ TreeConstructor tokenHandler = new TreeConstructor (disableIgnoreTokenInBodyStartTag , interpretSelfClosingAnythingElse , disableInTableTextForsterParenting );
119123 //
120124 tokenHandler .isHtmlFragmentParsing = true ;
121125 tokenHandler .scriptingFlag = scriptingFlag ;
@@ -187,7 +191,11 @@ private static Element getFirstFormElementFrom(Node node) {
187191 }
188192
189193 private Document parse (ProcessedInputStream is ) {
190- TreeConstructor tokenHandler = new TreeConstructor (disableIgnoreTokenInBodyStartTag , interpretSelfClosingAnythingElse );
194+ TreeConstructor tokenHandler = new TreeConstructor (
195+ disableIgnoreTokenInBodyStartTag ,
196+ interpretSelfClosingAnythingElse ,
197+ disableInTableTextForsterParenting
198+ );
191199 tokenHandler .scriptingFlag = scriptingFlag ;
192200 Tokenizer tokenizer = new Tokenizer (tokenHandler , transformEntities );
193201 tokenHandler .setTokenizer (tokenizer );
0 commit comments