1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 08:05:07 +00:00
serenity/Tests/LibWeb/Layout/input/table/colspan-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

33 lines
No EOL
669 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>Colspan 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 colspan="3">Cell 1</td>
</tr>
<tr>
<td colspan="3foo">Cell 2</td>
</tr>
<tr>
<td>Cell 3</td>
<td>Cell 4</td>
<td>Cell 5</td>
</tr>
</table>
</body>
</html>