happo 2.5.2 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a09a6eec66779447b6ca4ab2bae97639a1b0580
4
- data.tar.gz: fc22584f040c324fc81c00ae3f50eacd78ad7bbb
3
+ metadata.gz: f9a8cddb3cdd182db6d8d96d32b9a81c5802f449
4
+ data.tar.gz: 6d9726df428ef2da13115dbfedbf739d27e0875d
5
5
  SHA512:
6
- metadata.gz: 4b20a65e01766a900074ef668295ef21d807dbcbf731230335ee304cd4628647d324dca7bfcf63cb174fa04dd2ba4f214e74a25a9f01f5aa1ba94c745824c09a
7
- data.tar.gz: 2158fbc4558027fa4e5a9f4af41d1361c3b9ccf098e151aa6f56cca23f8c154c638eaf557a53051ff71d32719eb68970b2e8abaf24f6ee76d1d527bb570f58bd
6
+ metadata.gz: f1b0f14bc41131d94b70ae1efc96bcde6e717958634dcb72cdd73438cc503b0a2aeadc1b7336589df246c1765c6c589ae1d313c4cba96c04b29d8d13ffb520c5
7
+ data.tar.gz: af494cf1cc7b4d18cf2aae3ab6941157f35a2cc474d9e7e1e3ae3c5661884cb54d838baf26a1939e02b869f4add0a1f6b7bb0739415cb1f8fb71d2b35b1fb90d
@@ -162,8 +162,27 @@ window.happo = {
162
162
  }
163
163
  },
164
164
 
165
+ // Scrollbars inside of elements may cause spurious visual diffs. To avoid
166
+ // this issue, we can hide them automatically by styling the overflow to be
167
+ // hidden.
168
+ removeScrollbars: function removeScrollbars(node) {
169
+ if (
170
+ node.scrollHeight !== node.clientHeight
171
+ || node.scrollWidth !== node.clientWidth
172
+ ) {
173
+ // We style this via node.style.cssText so that we can override any styles
174
+ // that might already be `!important`.
175
+ // eslint-disable-next-line no-param-reassign
176
+ node.style.cssText += 'overflow: hidden !important';
177
+ }
178
+ },
179
+
165
180
  // This function takes a node and a box object that we will mutate.
166
181
  getFullRectRecursive: function getFullRectRecursive(node, box) {
182
+ // Since we are already traversing through every node, let's piggyback on
183
+ // that work and remove scrollbars to prevent spurious diffs.
184
+ this.removeScrollbars(node);
185
+
167
186
  var rect = node.getBoundingClientRect();
168
187
 
169
188
  /* eslint-disable no-param-reassign */
@@ -183,6 +202,8 @@ window.happo = {
183
202
  // absolutely positioned elements. It is important that this is fast, since we
184
203
  // may be iterating over a high number of nodes.
185
204
  getFullRect: function getFullRect(node) {
205
+ this.removeScrollbars(node);
206
+
186
207
  var rect = node.getBoundingClientRect();
187
208
 
188
209
  // Set up the initial object that we will mutate in our recursive function.
data/lib/happo/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module Happo
3
- VERSION = '2.5.2'
3
+ VERSION = '2.6.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henric Trotzig
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-01 00:00:00.000000000 Z
12
+ date: 2016-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chunky_png