Skip to content
Gx
GitHub

GX2020: element in a parent where a browser moves or drops it

An element is inside a parent that HTML does not allow, so the parser of the browser changes the tree.

Cause

The parser of a browser repairs some markup. It ends a p before a div, a list or a heading. It moves or drops a tr with no table, a td with no row and a li with no list. The page then has a different tree from the .gx file: a style or a patch does not find its element, and a morph changes the wrong one.

Gx reads one file. An element at the top of a component has no finding, because its parent is in a different file.

Example

note/Note.gx
package note

<p class="note">
  Read this first.
  <div class="box">A box</div>
</p>

gx check reports:

gx check
note/Note.gx:5:3: GX2020: the <div> is inside a <p>: a browser ends the paragraph before it

Fix

  1. In a paragraph, use span for a box of text. Or make the paragraph a div.
  2. Put a li inside ul, ol or menu. Put a tr inside table, thead, tbody or tfoot, and a td inside a tr.