Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.75k stars 805 forks source link

[BUG] List & other tag behavior different between String and Element #1397

Open Skylled opened 5 months ago

Skylled commented 5 months ago

Describe the bug:

The same HTML code produces different results depending on whether I use Html.fromElement or Html.

There are quite a few discrepancies, but the most easily described is that <ol> tags no longer increment correctly. When using Html.fromElement, all list items are prepended with "0." Using the same HTML code (obtained via element.outerHtml) but with the Html() constructor, lists appear correctly.

HTML to reproduce the issue:

<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>

Expected behavior: An ordered list should enumerate correctly regardless of whether the HTML was pre-parsed.

Screenshots:

Screenshot 2023-12-11 10 36 15 AM Screenshot 2023-12-11 10 35 24 AM

Device details and Flutter/Dart/flutter_html versions:

Flutter 3.16.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b0366e0a3f (6 days ago) • 2023-12-05 19:46:39 -0800
Engine • revision 54a7145303
Tools • Dart 3.2.3 • DevTools 2.28.4

flutter_html version: 3.0.0-beta2 Device: iOS Simulator & iPad Pro

A picture of a cute animal (not mandatory but encouraged)

toffee-xmas-tree