summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/css/scanner/scanner.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/css/scanner/scanner.go')
-rw-r--r--vendor/github.com/gorilla/css/scanner/scanner.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/vendor/github.com/gorilla/css/scanner/scanner.go b/vendor/github.com/gorilla/css/scanner/scanner.go
index 23fa7404e..25a7c6576 100644
--- a/vendor/github.com/gorilla/css/scanner/scanner.go
+++ b/vendor/github.com/gorilla/css/scanner/scanner.go
@@ -191,7 +191,11 @@ func init() {
// New returns a new CSS scanner for the given input.
func New(input string) *Scanner {
// Normalize newlines.
+ // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
input = strings.Replace(input, "\r\n", "\n", -1)
+ input = strings.Replace(input, "\r", "\n", -1)
+ input = strings.Replace(input, "\f", "\n", -1)
+ input = strings.Replace(input, "\u0000", "\ufffd", -1)
return &Scanner{
input: input,
row: 1,
@@ -232,7 +236,7 @@ func (s *Scanner) Next() *Token {
// shortcut before testing multiple regexps.
input := s.input[s.pos:]
switch input[0] {
- case '\t', '\n', '\f', '\r', ' ':
+ case '\t', '\n', ' ':
// Whitespace.
return s.emitToken(TokenS, matchers[TokenS].FindString(input))
case '.':