diff --git a/extra/html/parser/state/state-tests.factor b/extra/html/parser/state/state-tests.factor
index 4e0d512e89..316fe31805 100644
--- a/extra/html/parser/state/state-tests.factor
+++ b/extra/html/parser/state/state-tests.factor
@@ -66,3 +66,16 @@ IN: html.parser.state.tests
[ CHAR: \ CHAR: " take-quoted-string drop ]
[ skip-whitespace "asdf" take-sequence ] bi
] unit-test
+
+[ f ]
+[
+ "\"abc asdf"
+ CHAR: \ CHAR: " take-quoted-string
+] unit-test
+
+[ "\"abc" ]
+[
+ "\"abc asdf"
+ [ CHAR: \ CHAR: " take-quoted-string drop ]
+ [ "\"abc" take-sequence ] bi
+] unit-test
diff --git a/extra/html/parser/state/state.factor b/extra/html/parser/state/state.factor
index 22e901a310..8a9084b91b 100644
--- a/extra/html/parser/state/state.factor
+++ b/extra/html/parser/state/state.factor
@@ -83,11 +83,16 @@ TUPLE: state-parser sequence n ;
[ ] dip call ; inline
:: take-quoted-string ( state-parser escape-char quote-char -- string )
+ state-parser n>> :> start-n
state-parser advance
[
{
[ { [ previous quote-char = ] [ current quote-char = ] } 1&& ]
[ current quote-char = not ]
} 1||
- ] take-while
- state-parser advance* ;
+ ] take-while :> string
+ state-parser current quote-char = [
+ state-parser advance* string
+ ] [
+ start-n state-parser (>>n) f
+ ] if ;