You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with markup generated via components, or component testing, sometimes you receive stubbed markup that represents HTML5 compliant code, but is abstracted. For example:
parseFragment Input
Output
<tbody><tr><td>
Text
</td></tr><component-that-gets-rendered-as-tr/></tbody>
<tbody><tr><td>
Text
</td></tr></tbody><component-that-gets-rendered-as-tr></component-that-gets-rendered-as-tr>
<table><tbody><tr><td>
Text
</td></tr><component-that-gets-rendered-as-tr/></tbody></table>
<component-that-gets-rendered-as-tr></component-that-gets-rendered-as-tr><table><tbody><tr><td>
Text
</td></tr></tbody></table>
Parse5 sees that there is a non <tr> as a direct descendant of a <tbody>, and as a result, it tries to correct the situation by relocating the child to a different place in the DOM.
Would it be possible to retain the nested DOM hierarchy of the original input in the produced AST, given a specific boolean option being set? Something like this:
import{parseFragment}from'parse5';constmarkup=`<tbody> <tr> <td> Text </td> </tr> <component-that-gets-rendered-as-tr /></tbody>`.trim();constastOptions={sourceCodeLocationInfo: true,retainOriginalHierarchy: true};constast=parseFragment(markup,astOptions);
The text was updated successfully, but these errors were encountered:
When working with markup generated via components, or component testing, sometimes you receive stubbed markup that represents HTML5 compliant code, but is abstracted. For example:
parseFragment
InputParse5 sees that there is a non
<tr>
as a direct descendant of a<tbody>
, and as a result, it tries to correct the situation by relocating the child to a different place in the DOM.Would it be possible to retain the nested DOM hierarchy of the original input in the produced AST, given a specific boolean option being set? Something like this:
The text was updated successfully, but these errors were encountered: