From 12b783ca4e3d57008799d97fa25014373fbc47ad Mon Sep 17 00:00:00 2001 From: Mathieu Agopian Date: Tue, 9 Apr 2019 20:53:41 +0200 Subject: [PATCH] Don't parse invalid characters for attribute names --- src/Html/Parser.elm | 2 +- tests/Main.elm | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Html/Parser.elm b/src/Html/Parser.elm index e708c72..84768ef 100644 --- a/src/Html/Parser.elm +++ b/src/Html/Parser.elm @@ -372,7 +372,7 @@ isTagAttributeCharacter c = isSpaceCharacter : Char -> Bool isSpaceCharacter c = - c == ' ' || c == '\t' || c == '\n' || c == '\u{000D}' || c == '\u{000C}' + c == ' ' || c == '\t' || c == '\n' || c == '\u{000D}' || c == '\u{000C}' || c == '\u{00A0}' diff --git a/tests/Main.elm b/tests/Main.elm index 8e91cc6..513a51e 100644 --- a/tests/Main.elm +++ b/tests/Main.elm @@ -180,6 +180,9 @@ attributeTests = , test "basic13" (testParse """""" (Element "html" [ ( "xmlns:v", "urn:schemas-microsoft-com:vml" ) ] [])) , test "basic14" (testParse """""" (Element "link" [ ( "rel", "stylesheet" ), ( "href", "" ) ] [])) + + -- Invalid attribute names shouldn't be parsed: https://github.com/elm/html/issues/46 + , test "invalid character" (testParse """

""" (Element "p" [] [])) ]