mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 11:18:13 +00:00
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.
This commit is contained in:
parent
9812031a02
commit
04bc9b14d0
5 changed files with 405 additions and 2 deletions
|
@ -0,0 +1,33 @@
|
|||
<!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>
|
|
@ -0,0 +1,45 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue