@@ -214,7 +214,7 @@ public HTMLElements() {
214214 // initialize array of element information
215215 elementsArray ['A' - 'A' ] = new Element [] {
216216 // A - - (%inline;)* -(A)
217- new Element (A , "A" , Element .CONTAINER , BODY , new short [] {A }),
217+ new Element (A , "A" , Element .CONTAINER | Element . FORMATTING , BODY , new short [] {A }),
218218 // ABBR - - (%inline;)*
219219 new Element (ABBR , "ABBR" , Element .INLINE , BODY , null ),
220220 // ACRONYM - - (%inline;)*
@@ -234,7 +234,7 @@ public HTMLElements() {
234234 };
235235 elementsArray ['B' - 'A' ] = new Element [] {
236236 // B - - (%inline;)*
237- new Element (B , "B" , Element .INLINE , BODY , new short [] {SVG }),
237+ new Element (B , "B" , Element .INLINE | Element . FORMATTING , BODY , new short [] {SVG }),
238238 // BASE - O EMPTY
239239 new Element (BASE , "BASE" , Element .EMPTY , HEAD , null ),
240240 // BASEFONT
@@ -246,7 +246,7 @@ public HTMLElements() {
246246 // BGSOUND
247247 new Element (BGSOUND , "BGSOUND" , Element .EMPTY , HEAD , null ),
248248 // BIG - - (%inline;)*
249- new Element (BIG , "BIG" , Element .INLINE , BODY , new short []{SVG }),
249+ new Element (BIG , "BIG" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
250250 // BLINK
251251 new Element (BLINK , "BLINK" , Element .INLINE , BODY , null ),
252252 // BLOCKQUOTE - - (%block;|SCRIPT)+
@@ -267,7 +267,7 @@ public HTMLElements() {
267267 // CITE - - (%inline;)*
268268 new Element (CITE , "CITE" , Element .INLINE , BODY , null ),
269269 // CODE - - (%inline;)*
270- new Element (CODE , "CODE" , Element .INLINE , BODY , new short []{SVG }),
270+ new Element (CODE , "CODE" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
271271 // COL - O EMPTY
272272 new Element (COL , "COL" , Element .EMPTY , COLGROUP , null ),
273273 // COLGROUP - O (COL)*
@@ -301,7 +301,7 @@ public HTMLElements() {
301301 };
302302 elementsArray ['E' - 'A' ] = new Element [] {
303303 // EM - - (%inline;)*
304- new Element (EM , "EM" , Element .INLINE , BODY , new short []{SVG }),
304+ new Element (EM , "EM" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
305305 // EMBED
306306 new Element (EMBED , "EMBED" , Element .EMPTY , BODY , new short []{SVG }),
307307 };
@@ -313,7 +313,7 @@ public HTMLElements() {
313313
314314 new Element (FIGURE , "FIGURE" , Element .BLOCK , BODY , new short [] {P }),
315315 // FONT
316- new Element (FONT , "FONT" , Element .CONTAINER , BODY , null ),
316+ new Element (FONT , "FONT" , Element .CONTAINER | Element . FORMATTING , BODY , null ),
317317
318318 new Element (FOOTER , "FOOTER" , Element .BLOCK , BODY , new short [] {P }),
319319
@@ -344,7 +344,7 @@ public HTMLElements() {
344344 };
345345 elementsArray ['I' - 'A' ] = new Element [] {
346346 // I - - (%inline;)*
347- new Element (I , "I" , Element .INLINE , BODY , new short []{SVG }),
347+ new Element (I , "I" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
348348 // IFRAME
349349 new Element (IFRAME , "IFRAME" , Element .BLOCK , BODY , null ),
350350 // ILAYER
@@ -401,7 +401,7 @@ public HTMLElements() {
401401 // NEXTID
402402 new Element (NEXTID , "NEXTID" , Element .INLINE , BODY , null ),
403403 // NOBR
404- new Element (NOBR , "NOBR" , Element .INLINE , BODY , new short []{NOBR , SVG }),
404+ new Element (NOBR , "NOBR" , Element .INLINE | Element . FORMATTING , BODY , new short []{NOBR , SVG }),
405405 // NOEMBED
406406 new Element (NOEMBED , "NOEMBED" , Element .CONTAINER , BODY , null ),
407407 // NOFRAMES - - (BODY) -(NOFRAMES)
@@ -457,7 +457,7 @@ public HTMLElements() {
457457 };
458458 elementsArray ['S' - 'A' ] = new Element [] {
459459 // S
460- new Element (S , "S" , Element .INLINE , BODY , new short []{SVG }),
460+ new Element (S , "S" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
461461 // SAMP - - (%inline;)*
462462 new Element (SAMP , "SAMP" , Element .INLINE , BODY , null ),
463463 // SCRIPT - - %Script;
@@ -470,7 +470,7 @@ public HTMLElements() {
470470
471471 new Element (SLOT , "SLOT" , Element .CONTAINER , BODY , null ),
472472 // SMALL - - (%inline;)*
473- new Element (SMALL , "SMALL" , Element .INLINE , BODY , new short []{SVG }),
473+ new Element (SMALL , "SMALL" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
474474 // SOUND
475475 new Element (SOUND , "SOUND" , Element .EMPTY , HEAD , null ),
476476
@@ -480,9 +480,9 @@ public HTMLElements() {
480480 // SPAN - - (%inline;)*
481481 new Element (SPAN , "SPAN" , Element .CONTAINER , BODY , new short []{SVG }),
482482 // STRIKE
483- new Element (STRIKE , "STRIKE" , Element .INLINE , BODY , new short []{SVG }),
483+ new Element (STRIKE , "STRIKE" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
484484 // STRONG - - (%inline;)*
485- new Element (STRONG , "STRONG" , Element .INLINE , BODY , new short []{SVG }),
485+ new Element (STRONG , "STRONG" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
486486 // STYLE - - %StyleSheet;
487487 new Element (STYLE , "STYLE" , Element .SPECIAL , new short []{HEAD , BODY }, new short []{STYLE , TITLE , META }),
488488 // SUB - - (%inline;)*
@@ -523,11 +523,11 @@ public HTMLElements() {
523523
524524 new Element (TRACK , "TRACK" , Element .EMPTY , BODY , null ),
525525 // TT - - (%inline;)*
526- new Element (TT , "TT" , Element .INLINE , BODY , new short []{SVG }),
526+ new Element (TT , "TT" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
527527 };
528528 elementsArray ['U' - 'A' ] = new Element [] {
529529 // U,
530- new Element (U , "U" , Element .INLINE , BODY , new short []{SVG }),
530+ new Element (U , "U" , Element .INLINE | Element . FORMATTING , BODY , new short []{SVG }),
531531 // UL - - (LI)+
532532 new Element (UL , "UL" , Element .CONTAINER , BODY , new short [] {P , SVG }),
533533 };
@@ -771,6 +771,12 @@ public static class Element {
771771 */
772772 public static final int SCRIPT_SUPPORTING = 0x20 ;
773773
774+ /**
775+ * Formatting elements.
776+ * <a href='https://html.spec.whatwg.org/#formatting'>active formatting elements</a>
777+ */
778+ public static final int FORMATTING = 0x40 ;
779+
774780 /** The element code. */
775781 public final short code ;
776782
@@ -903,6 +909,13 @@ public final boolean isScriptSupporting() {
903909 return (flags & SCRIPT_SUPPORTING ) != 0 ;
904910 }
905911
912+ /**
913+ * @return true if this element is formatting one.
914+ */
915+ public final boolean isFormatting () {
916+ return (flags & FORMATTING ) != 0 ;
917+ }
918+
906919 /**
907920 * @return true if this element can close the specified Element.
908921 *
0 commit comments