Skip to content

Preserve form feeds in quoted attribute values - #282

Open
ac1982 wants to merge 1 commit into
Masterminds:masterfrom
ac1982:fix/quoted-attribute-form-feed
Open

ac1982 wants to merge 1 commit into
Masterminds:masterfrom
ac1982:fix/quoted-attribute-form-feed

Conversation

@ac1982

@ac1982 ac1982 commented Oct 20, 2026

Copy link
Copy Markdown

A form feed inside a quoted attribute currently ends the value early, dropping its remaining text and potentially treating it as additional attributes. For example, the alt value in <img alt="before\f after" src="foo.png"> is truncated.

Remove form feed from the quoted-value stop characters, as required by the HTML tokenization rules. Unquoted attributes still treat it as a separator. Tests exercise single and double quotes, character references, subsequent attributes, full documents, fragments, and serialization/reparsing.

Fixes #280.

Validation: PHP 8.5.4 / PHPUnit 10.5.66, 169 tests and 2,162 assertions pass. The regression fails before the change. The three PHPUnit data-provider deprecations also occur on the clean base. PHP CS Fixer 2.19.3 reports only the same existing by-reference spacing changes on base and patch; other PHP versions were not run locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow form feed characters in attributes

1 participant