Allow form feed characters in attributes
还没有人认领这个 Issue。
评估
调研方向
从 Tokenizer::quotedAttributeValue() 开始,使用包含换页符的 img alt 属性重现该问题,并将 HTML5 输出与 DOMDocument 进行比较。追踪换页符之后的文本为何会被丢弃,然后添加覆盖测试,展示该字符会像原生 DOM 输出中一样被保留。
由索引模型根据 Issue 内容生成。
描述
Tokenizer::quotedAttributeValue() has special handling for form feed characters.
(This used to also include newlines and tabs but was removed in https://github.com/Masterminds/html5-php/commit/8785fc5775df52dd4a6b63677ebd08f8301ffdcc.)
Because of this, if an attribute contains a form feed, everything after this character is ignored.
This creates a discrepancy between masterminds/html5 and the native DOM extension:
$html = "<img src='foo.png' alt='before \f after'>";
$html5 = new HTML5();
$dom = $html5->loadHTML($html);
echo $html5->saveHTML($dom);
// <img src="foo.png" alt="before ">
$dom = new DOMDocument();
$dom->loadHTML($html);
echo $dom->saveHTML();
// <img src="foo.png" alt="before after">
This HTML containing a form feed character in the alt attribute is valid according to https://validator.w3.org/:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<img src="foo.png" alt=" foo">
</body>
</html>
- 主要语言
- HTML
- 星标
- 1.8k
- 派生
- 123
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Masterminds/html5-php 的其他 Issue
-
Template contents participate in the DOM tree可能已有人在做 @eyupcanakman 于 205 天前认领。 未关闭help-wanted
难度 4/5 3-5 天 新手友好度 35/100
Masterminds/html5-php#252 · 1 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
Masterminds/html5-php#251 ·
-
Parser remove the single < (less than) character from given html string可能已有人在做 @bsweeney 于 790 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
Masterminds/html5-php#250 · 5 条评论 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 28/100
Masterminds/html5-php#246 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
Masterminds/html5-php#245 · 1 条评论 ·
查看 Masterminds/html5-php 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
decentralized-identity/didwebvh-ts#203 ·
维护者通常 1 天内回复
-
kind/bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
area/map-site bug layer/core size/S
难度 2/5 1-3 小时 新手友好度 88/100
marola-dev/marola-app#60 ·
维护者通常 1 天内回复
-
Telegram webhook: line breaks lost since switch to rich messages可能已有人在做 @Kshot3000 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
get_seat_availability: 'GNWL/AVAILABLE'-style statuses are reported as available with no seat count未关闭bug good first issue tools
难度 2/5 1-3 小时 新手友好度 78/100