1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 10:25:07 +00:00
serenity/Tests/LibWeb/Layout/input/table/rowspan-with-trailing-characters.html
Jonatan Klemets 04bc9b14d0 LibWeb: Use parse_non_negative_integer for colspan and rowspan parsing
`DeprecatedString::to_int` calls `StringUtils::convert_to_int`
internally. However, the integer parsing is not done in an HTML
spec-compliant way. For example, `colspan="2;"` is valid according to
the spec. But, with the current implementation, we will fail to parse
"2;", and instead fall back to using 1 as the colspan value.

This patch changes the `HTMLTableCellElement::col_span` and
`HTMLTableCellElement::row_span` methods to use the
`Web::HTML::parse_non_negative_integer` function that will parse the
attribute value in an HTML spec-compliant way.
2023-08-24 22:26:53 +01:00

45 lines
No EOL
831 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>Rowspan relaxed parsing</title>
<style>
table, td {
border: 1px solid black;
border-spacing: 0;
text-align: center;
}
</style>
</head>
<body>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td rowspan="2">Cell 3</td>
</tr>
<tr>
<td>Cell 4</td>
<td>Cell 5</td>
</tr>
<tr>
<td>Cell 6</td>
<td>Cell 7</td>
<td>Cell 8</td>
</tr>
<tr>
<td>Cell 9</td>
<td>Cell 10</td>
<td rowspan="2foo">Cell 11</td>
</tr>
<tr>
<td>Cell 12</td>
<td>Cell 13</td>
</tr>
</table>
</body>
</html>