From 7d029ae7b2b350b515038ae48c35340cbf26ad9c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 10 Jun 2014 21:07:44 +0530 Subject: [PATCH] Fix field-value checking to not throw for lone spaces --- src/components/script/dom/bindings/str.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/script/dom/bindings/str.rs b/src/components/script/dom/bindings/str.rs index ae6c721abea..6db3f6c1f97 100644 --- a/src/components/script/dom/bindings/str.rs +++ b/src/components/script/dom/bindings/str.rs @@ -94,7 +94,21 @@ impl ByteString { false } }, - 32 | 9 => { // SP | HT + 32 => { // SP + if prev == LF || prev == SPHT { + prev = SPHT; + true + } else if prev == Other { + // Counts as an Other here, since it's not preceded by a CRLF + // SP is not a CTL, so it can be used anywhere + // though if used immediately after a CR the CR is invalid + // We don't change prev since it's already Other + true + } else { + false + } + }, + 9 => { // HT if prev == LF || prev == SPHT { prev = SPHT; true