Skip to content

GlobalAttributeValueQuote Initial influencing empty attributes #575

@cx-ricardo-puga

Description

@cx-ricardo-puga

_currentattribute.InternalQuoteType = AttributeValueQuote.WithoutValue;

1. Description

Since version v1.11.62, when the InternalQuoteType was introduced, I have noticed some unwanted changes in my conversions because it mixes the behavior of the QuoteType and WithoutValue in the attributes.

I'm my case I want to set the document to consider the Inicial QuoteType (the default, I believe) to maintain the original QuoteType and also set it to convert to an empty attribute (att=""). Supustly, converting to an empty attribute was the expected behavior but that isn't happening. Setting the GlobalAttributeValueQuote to Inicial the behavior is the same.

Example:
<bar ng-app class='message'></bar>
Actual:
<bar ng-app class='message'></bar>
Expected:
<bar ng-app="" class='message'></bar>

UT with default configs:

[Fact]
public void PreserveEmptyAttributesWithInitialTest()
{
    var d = new HtmlDocument();
    d.LoadHtml("<bar ng-app class='message'></bar>");
    var node = d.DocumentNode.SelectSingleNode("//bar");
    var outer = node.OuterHtml;
    Assert.Equal("<bar ng-app=\"\" class='message'></bar>", outer);
}

My suggestions:

  1. Considering by default that setting the GlobalAttributeValueQuote to Initial will set the isWithoutValue to false;

  2. Splitting the QuoteType and WithoutValue setting in two different settings;

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions