classlist 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -1
- data/Rakefile +5 -0
- data/lib/classlist/version.rb +1 -1
- data/lib/classlist.rb +30 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec22dd9c1f5a694e833da806219a4e2fc738ad0649a8caa3acf96b75ba55a706
|
|
4
|
+
data.tar.gz: ede23289a61180d0866e5c4734d1853bc12b8ac21cfb1b3af477c9aff8d2cecf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2de6755b0b6d59fc3b9534d16e97dfda5f858a6d06e46062ef729038e7bbf64d32612f134f2ee4990a5f098ec0877daddb2f0be0e64ef2296cc3af14d7753825
|
|
7
|
+
data.tar.gz: 7830b58c5677300c4f42bdd2a2dea0b03c11b75fd6958e773586bdbecf65d5c225d798268339eb181def6cc34eea74096e6e5e5d184dec56ea06cef81cf31010
|
data/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## 1.1.3 - 2026-10-06
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Add support for Ruby 4.0 (no changes).
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Adding a String or Array to a Classlist with pending operations no longer drops those operations.
|
|
17
|
+
|
|
18
|
+
## 1.1.2 - 2026-08-06
|
|
19
|
+
|
|
12
20
|
### Fixed
|
|
13
21
|
|
|
22
|
+
- v1.1.1 unfortunately included a serious performance regression.
|
|
14
23
|
|
|
15
24
|
## [1.1.1] - 2025-12-08
|
|
16
25
|
|
data/Rakefile
CHANGED
|
@@ -10,4 +10,9 @@ Rake::TestTask.new(:test) do |t|
|
|
|
10
10
|
t.test_files = FileList["test/**/test_*.rb"]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
desc "Run performance benchmarks, failing if any operation's runtime is scaling worse than expected"
|
|
14
|
+
task :benchmark do
|
|
15
|
+
FileList["test/benchmark/*_benchmark.rb"].sort.each { |f| load f }
|
|
16
|
+
end
|
|
17
|
+
|
|
13
18
|
task default: %i[test standard]
|
data/lib/classlist/version.rb
CHANGED
data/lib/classlist.rb
CHANGED
|
@@ -30,8 +30,13 @@ class Classlist
|
|
|
30
30
|
result = other.merge(self)
|
|
31
31
|
Classlist.new(result)
|
|
32
32
|
else
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
# Resolve pending operations on a copy, so they are not lost and this
|
|
34
|
+
# classlist (including any shared operations) is left unchanged.
|
|
35
|
+
result = Classlist.new
|
|
36
|
+
result.copy_from(self, {}.compare_by_identity)
|
|
37
|
+
result.resolve_operations
|
|
38
|
+
result.add(other)
|
|
39
|
+
result
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
|
|
@@ -113,6 +118,8 @@ class Classlist
|
|
|
113
118
|
operations.each do |operation|
|
|
114
119
|
operation.resolve(original_classlist)
|
|
115
120
|
end
|
|
121
|
+
|
|
122
|
+
operations.clear
|
|
116
123
|
end
|
|
117
124
|
|
|
118
125
|
def to_a
|
|
@@ -149,6 +156,27 @@ class Classlist
|
|
|
149
156
|
end
|
|
150
157
|
end
|
|
151
158
|
|
|
159
|
+
protected
|
|
160
|
+
|
|
161
|
+
# Replaces entries and pending operations with copies of those in source, so
|
|
162
|
+
# resolving operations on this classlist doesn't change source.
|
|
163
|
+
#
|
|
164
|
+
# memo maps already copied operations to their copies by identity. An
|
|
165
|
+
# operation reachable through several paths is copied only once, so the copy
|
|
166
|
+
# resolves exactly like the original does.
|
|
167
|
+
def copy_from(source, memo)
|
|
168
|
+
@entries = source.entries.dup
|
|
169
|
+
@operations = source.operations.map { |operation| operation.deep_copy(memo) }
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def deep_copy(memo)
|
|
173
|
+
memo.fetch(self) do
|
|
174
|
+
copy = memo[self] = dup
|
|
175
|
+
copy.copy_from(self, memo)
|
|
176
|
+
copy
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
152
180
|
private
|
|
153
181
|
|
|
154
182
|
attr_writer :entries
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: classlist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakob Skjerning
|
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '0'
|
|
57
57
|
requirements: []
|
|
58
|
-
rubygems_version:
|
|
58
|
+
rubygems_version: 4.0.16
|
|
59
59
|
specification_version: 4
|
|
60
60
|
summary: Ruby implementation of the Element.classList DOM API
|
|
61
61
|
test_files: []
|