summaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/css/scanner/scanner.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-07-08 07:34:39 +0000
committerLibravatar GitHub <noreply@github.com>2024-07-08 07:34:39 +0000
commit5769722c583474d9ea3e346a7773261738245268 (patch)
tree91f35f10c92ac85092857e7c618a8a2377dd11fe /vendor/github.com/gorilla/css/scanner/scanner.go
parent[chore]: Bump golang.org/x/crypto from 0.24.0 to 0.25.0 (#3080) (diff)
downloadgotosocial-5769722c583474d9ea3e346a7773261738245268.tar.xz
[chore]: Bump github.com/microcosm-cc/bluemonday from 1.0.26 to 1.0.27 (#3081)
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 '.':