summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-01-24 00:10:04 (GMT)
committer Michael Drake <tlsa@netsurf-browser.org>2014-01-24 00:10:04 (GMT)
commite3a4e5ac220de292f186752c671225344a83b37e (patch)
tree3ca4c8b6ce103ac97fb7dea2b74520b4a45c0637
parent91bee91db8eb8d9a62afb31b3be5a834e8f2135d (diff)
downloadlibdom-e3a4e5ac220de292f186752c671225344a83b37e.tar.gz
libdom-e3a4e5ac220de292f186752c671225344a83b37e.tar.bz2
Fix STRIP_TRAILING to work fully when COLLAPSE isn't requested.
-rw-r--r--src/core/string.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/string.c b/src/core/string.c
index 9df2cd3..3c2037f 100644
--- a/src/core/string.c
+++ b/src/core/string.c
@@ -1076,10 +1076,14 @@ dom_exception dom_string_whitespace_op(dom_string *s,
}
if (op & DOM_WHITESPACE_STRIP_TRAILING) {
- if (temp_pos > temp) {
+ while (temp_pos > temp) {
temp_pos--;
- if (*temp_pos != ' ')
+ if (*temp_pos != ' ' && *temp_pos != '\t' &&
+ *temp_pos != '\n' && *temp_pos != '\r' &&
+ *temp_pos != '\f') {
temp_pos++;
+ break;
+ }
}
}