Skip to content

Commit a5d345b

Browse files
duonglaiquangrbri
authored andcommitted
HtmlTableCell: allow superfluous line breaks in rowspan/colspan
1 parent 3d8716e commit a5d345b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/main/java/org/htmlunit/html/HtmlTableCell.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import java.util.Map;
1818

19+
import org.apache.commons.lang3.StringUtils;
1920
import org.htmlunit.SgmlPage;
2021

2122
/**
@@ -48,7 +49,7 @@ protected HtmlTableCell(final String qualifiedName, final SgmlPage page,
4849
* @return the value of the colspan attribute, or <code>1</code> if the attribute wasn't specified
4950
*/
5051
public int getColumnSpan() {
51-
final String spanString = getAttributeDirect("colspan");
52+
final String spanString = StringUtils.replaceChars(getAttributeDirect("colspan"), "\r\n", null);
5253
if (spanString == null || spanString.isEmpty()) {
5354
return 1;
5455
}
@@ -65,7 +66,7 @@ public int getColumnSpan() {
6566
* @return the value of the rowspan attribute, or <code>1</code> if the attribute wasn't specified
6667
*/
6768
public int getRowSpan() {
68-
final String spanString = getAttributeDirect("rowspan");
69+
final String spanString = StringUtils.replaceChars(getAttributeDirect("rowspan"), "\r\n", null);
6970
if (spanString == null || spanString.isEmpty()) {
7071
return 1;
7172
}

src/main/java/org/htmlunit/javascript/host/html/HTMLTableCellElement.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import static org.htmlunit.BrowserVersionFeatures.JS_TABLE_SPAN_SET_ZERO_IF_INVALID;
1818

19+
import org.apache.commons.lang3.StringUtils;
1920
import org.htmlunit.css.ComputedCssStyleDeclaration;
2021
import org.htmlunit.css.StyleAttributes;
2122
import org.htmlunit.html.DomNode;
@@ -177,7 +178,7 @@ public void setBgColor(final String bgColor) {
177178
*/
178179
@JsxGetter
179180
public int getColSpan() {
180-
final String s = getDomNodeOrDie().getAttribute("colSpan");
181+
final String s = StringUtils.replaceChars(getDomNodeOrDie().getAttribute("colSpan"), "\r\n", null);
181182
try {
182183
return Integer.parseInt(s);
183184
}
@@ -210,7 +211,7 @@ public void setColSpan(final String colSpan) {
210211
*/
211212
@JsxGetter
212213
public int getRowSpan() {
213-
final String s = getDomNodeOrDie().getAttribute("rowSpan");
214+
final String s = StringUtils.replaceChars(getDomNodeOrDie().getAttribute("rowSpan"), "\r\n", null);
214215
try {
215216
return Integer.parseInt(s);
216217
}

0 commit comments

Comments
 (0)