Skip to content

Commit

Permalink
Don't parse invalid characters for attribute names
Browse files Browse the repository at this point in the history
  • Loading branch information
magopian committed Apr 9, 2019
1 parent 42f759c commit 12b783c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Html/Parser.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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}'



Expand Down
3 changes: 3 additions & 0 deletions tests/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ attributeTests =
, test "basic13" (testParse """<html xmlns:v="urn:schemas-microsoft-com:vml"></html>""" (Element "html" [ ( "xmlns:v", "urn:schemas-microsoft-com:vml" ) ] []))
, test "basic14" (testParse """<link rel=stylesheet
href="">""" (Element "link" [ ( "rel", "stylesheet" ), ( "href", "" ) ] []))

-- Invalid attribute names shouldn't be parsed: https://github.com/elm/html/issues/46
, test "invalid character" (testParse """<p\u{00A0} ></p>""" (Element "p" [] []))
]


Expand Down

0 comments on commit 12b783c

Please sign in to comment.