From 7577a69b607235471b1cad43f959e619f788df21 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Wed, 27 Oct 2021 10:18:19 -0400 Subject: [PATCH] Clarify new serialization options --- lib/Parser/Config.php | 6 +++--- lib/Parser/Serializer.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Parser/Config.php b/lib/Parser/Config.php index 1639dd6..c9fa025 100644 --- a/lib/Parser/Config.php +++ b/lib/Parser/Config.php @@ -19,9 +19,9 @@ class Config { public $htmlNamespace = null; /** @var bool|null Whether to retain processing instructions rather than parsing them into comments as the HTML specification requires. Setting this true will yield non-standard documents */ public $processingInstructions = null; - /** @var bool|null Whether to self-close void foreign elements during serialization. Per the standard all foreign elements have their end tags printed */ - public $serializeVoidEndTags = null; - /** @var bool|null Whether to include the values of boolean attributes on HTML elements during serialization. Per the standard this should be true, but may be false to minimize relevant attributes */ + /** @var bool|null Whether to print the end tags of foreign void elements rather than self-closing their start tags. Per the standard this is true by default */ + public $serializeForeignVoidEndTags = null; + /** @var bool|null Whether to include the values of boolean attributes on HTML elements during serialization. Per the standard this is true by default */ public $serializeBooleanAttributeValues = null; /* Future serializer settings might include: diff --git a/lib/Parser/Serializer.php b/lib/Parser/Serializer.php index 75e49e4..65be88e 100644 --- a/lib/Parser/Serializer.php +++ b/lib/Parser/Serializer.php @@ -48,7 +48,7 @@ abstract class Serializer { public static function serialize(\DOMNode $node, ?Config $config = null): string { $config = $config ?? new Config; $boolAttr = $config->serializeBooleanAttributeValues ?? true; - $endTags = $config->serializeVoidEndTags ?? true; + $endTags = $config->serializeForeignVoidEndTags ?? true; $s = ""; $stack = [];