aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/andybalholm/cascadia/specificity.go
diff options
context:
space:
mode:
authorrenovate <renovate-bot@autistici.org>2021-07-11 14:26:26 +0000
committerrenovate <renovate-bot@autistici.org>2021-07-11 14:26:26 +0000
commit557f9d889812976293b4a668c190e0e1e0332857 (patch)
tree9d2e82374a063f3b568110e83ccb1b285f3247f1 /vendor/github.com/andybalholm/cascadia/specificity.go
parent877afafd950b84242204499b3ed8c1b2c8c75f31 (diff)
downloadcrawl-557f9d889812976293b4a668c190e0e1e0332857.tar.gz
crawl-557f9d889812976293b4a668c190e0e1e0332857.zip
Update module github.com/PuerkitoBio/goquery to v1.7.1
Diffstat (limited to 'vendor/github.com/andybalholm/cascadia/specificity.go')
-rw-r--r--vendor/github.com/andybalholm/cascadia/specificity.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/andybalholm/cascadia/specificity.go b/vendor/github.com/andybalholm/cascadia/specificity.go
new file mode 100644
index 0000000..8db864f
--- /dev/null
+++ b/vendor/github.com/andybalholm/cascadia/specificity.go
@@ -0,0 +1,26 @@
+package cascadia
+
+// Specificity is the CSS specificity as defined in
+// https://www.w3.org/TR/selectors/#specificity-rules
+// with the convention Specificity = [A,B,C].
+type Specificity [3]int
+
+// returns `true` if s < other (strictly), false otherwise
+func (s Specificity) Less(other Specificity) bool {
+ for i := range s {
+ if s[i] < other[i] {
+ return true
+ }
+ if s[i] > other[i] {
+ return false
+ }
+ }
+ return false
+}
+
+func (s Specificity) Add(other Specificity) Specificity {
+ for i, sp := range other {
+ s[i] += sp
+ }
+ return s
+}