Skip to content

htmlPrefilter() adds bogus element after self-closing tags #4191

@martinml

Description

@martinml

Being <x> any valid element, using htmlPrefilter() to parse a <br /> element inside an attribute of an <x> element adds a spurious </x> after it:

$.htmlPrefilter('<x foo="<br />"></x>');

This returns <x foo="<br ></x>"></x> (note the extra </x> inside the foo attribute).

I browsed other issues and I saw that a related one was marked as invalid because void elements must not have closing tags in HTML. This might be the same case, but the docs say that "[htmlPrefilter] will greedily ensure that all tags are XHTML-compliant", and I understand that <br /> is definitely valid XHTML (and this behavior ironically makes it invalid).

Is this a documentation thing, a bug (probably in the rxhtmlTag regex?) or am I missing something else?

Metadata

Metadata

Assignees

No one assigned

    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