Skip to content

Commit 679760c

Browse files
jakejackson1claude
andcommitted
Track the stack of open elements while HTML is written
WriteHTML() keeps a frame for each element open in the HTML it reads: its tag, id, classes, language and attributes, its position among its siblings and among those of its tag, and a record of the siblings closed before it. Selectors that look at ancestors and siblings will read it through Mpdf::getOpenElements(). It follows real tokens only, so forced page breaks leave it alone. It is put back with the rest of the state when a page-break-inside: avoid block unwinds. Headers, footers and the index set the flow's stack aside, and a positioned block's content is written against the stack as it stood inside the block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 07af517 commit 679760c

5 files changed

Lines changed: 732 additions & 11 deletions

File tree

‎CHANGELOG-GRAVITYPDF.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ These changes do not change output.
356356
* The coding standard and PHPStan run as one Lint workflow. The e-invoice and PDF/X-4 checks run on a pull request only when it changes the code they cover.
357357
* **PHPStan.** Fixes for newer PHP versions and PHPStan 2.2.15. [#6] [#295] [#319] [#451]
358358
* **Branch alias.** The Composer branch alias maps `dev-gravitypdf` to `8.x-dev`. [#3]
359+
* **Open elements.** `WriteHTML()` keeps a stack of the elements open in the HTML it reads, with each element's position among its siblings and a record of the siblings before it, for selectors that look at ancestors and siblings. `Mpdf::getOpenElements()` reads it. [#533]
359360

360361
[mpdf/mpdf#83]: https://github.com/mpdf/mpdf/issues/83
361362
[mpdf/mpdf#747]: https://github.com/mpdf/mpdf/issues/747
@@ -750,6 +751,7 @@ These changes do not change output.
750751
[#526]: https://github.com/GravityPDF/mpdf/issues/526
751752
[#527]: https://github.com/GravityPDF/mpdf/issues/527
752753
[#528]: https://github.com/GravityPDF/mpdf/issues/528
754+
[#533]: https://github.com/GravityPDF/mpdf/issues/533
753755
[#549]: https://github.com/GravityPDF/mpdf/pull/549
754756
[#552]: https://github.com/GravityPDF/mpdf/issues/552
755757
[#560]: https://github.com/GravityPDF/mpdf/pull/560

0 commit comments

Comments
 (0)