Consider passing mergeIdAndProperties as true in GenericAttributesParser #50

Closed
opened 2026-01-29 14:23:14 +00:00 by claunia · 0 comments
Owner

Originally created by @christophano on GitHub (Aug 22, 2016).

Line 67 of GenericAttributesParser.cs calls the CopyTo method of the HtmlAttributes class.
It passes false as the MergeIdAndProperties argument, which means the existing Id is overwritten, even if there is no id on the instance itself.
If the argument is changed to true, then the Id property will only be overwritten if it has been set on the instance.

The scenario that I'm facing right now, is that I have an extension to automatically create Ids for definition term elements (based on their content) but, if I want to also apply a class using the Special Attributes extension, the id gets overwritten.

Originally created by @christophano on GitHub (Aug 22, 2016). Line 67 of `GenericAttributesParser.cs` calls the `CopyTo` method of the `HtmlAttributes` class. It passes false as the `MergeIdAndProperties` argument, which means the existing `Id` is overwritten, _even if there is no id on the instance itself_. If the argument is changed to true, then the `Id` property will only be overwritten if it has been set on the instance. The scenario that I'm facing right now, is that I have an extension to automatically create Ids for definition term elements (based on their content) but, if I want to also apply a class using the `Special Attributes` extension, the id gets overwritten.
claunia added the bug label 2026-01-29 14:23:14 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#50