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)
commita4489e74fb5171236420c878ed083e51036416bb (patch)
tree3ca4c8b6ce103ac97fb7dea2b74520b4a45c0637
parent23a0d42db30ac6ea2e60f442735ee5199b7acc0b (diff)
downloadlibdom-a4489e74fb5171236420c878ed083e51036416bb.tar.gz
libdom-a4489e74fb5171236420c878ed083e51036416bb.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;
+ }
}
}