Skip to content

Commit ffdcd17

Browse files
authored
Properly Parse <input> (#457)
* Properly Parse <input> Resolves #456 * test for parsing <input> * fix test case * fix formatting
1 parent cc1507c commit ffdcd17

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

src/microformats/property.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const getType = (className: string): PropertyType =>
3333
export const parseP = (node: Element, options: ParsingOptions): string =>
3434
valueClassPattern(node, options) ??
3535
getAttributeIfTag(node, ["abbr", "link"], "title") ??
36-
getAttributeIfTag(node, ["data"], "value") ??
36+
getAttributeIfTag(node, ["input", "data"], "value") ??
3737
getAttributeIfTag(node, ["img", "area"], "alt") ??
3838
getAttributeIfTag(node, ["meta"], "content") ??
3939
impliedTextContent(node, options);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html lang="en">
2+
<body>
3+
<div class="h-item">
4+
<input class="p-name" type="text" value="A" />
5+
<input class="p-value" type="number" value="10" />
6+
</div>
7+
</body>
8+
</html>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"rels": {},
3+
"rel-urls": {},
4+
"items": [
5+
{
6+
"type": ["h-item"],
7+
"properties": {
8+
"name": ["A"],
9+
"value": ["10"]
10+
}
11+
}
12+
]
13+
}

0 commit comments

Comments
 (0)