Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 30024560: Issue 7450 - Implement hide-if-contains-visible-text snippet (Closed)

Created:
March 6, 2019, 3:21 p.m. by hub
Modified:
May 10, 2019, 2:17 p.m.
CC:
Manish Jethani, Felix Dahlke
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

Issue 7450 - Implement hide-if-contains-visible-text snippet

Patch Set 1 #

Total comments: 9

Patch Set 2 : Now handle when the element is hidden #

Patch Set 3 : This is now a snippet #

Patch Set 4 : added docs, more test. #

Total comments: 26

Patch Set 5 : Rework snippet #

Patch Set 6 : Minor documentation tweak #

Total comments: 16

Patch Set 7 : Review comments addressed #

Patch Set 8 : a couple of jsdocs fixes #

Patch Set 9 : Snippet is now type 1 #

Total comments: 7

Patch Set 10 : Fixed a few nits. Unfactored test code. #

Total comments: 20

Patch Set 11 : Added some more CSS properties to check. Minor review comments addressed. #

Total comments: 2

Patch Set 12 : Properly handle visibility #

Total comments: 4

Patch Set 13 : Check about null parent and use parentElement instead #

Patch Set 14 : Updated patch for real #

Unified diffs Side-by-side diffs Delta from patch set Stats (+264 lines, -17 lines) Patch
M lib/content/snippets.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +144 lines, -17 lines 0 comments Download
M test/browser/snippets.js View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +120 lines, -0 lines 0 comments Download

Messages

Total messages: 49
hub
March 6, 2019, 3:21 p.m. (2019-03-06 15:21:43 UTC) #1
hub
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); I wonder if it is ...
March 6, 2019, 4:34 p.m. (2019-03-06 16:34:12 UTC) #2
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode375 lib/content/elemHideEmulation.js:375: function getVisibleContent(element) Instead of doing all this, why not ...
March 12, 2019, 8:44 a.m. (2019-03-12 08:44:02 UTC) #3
hub
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode375 lib/content/elemHideEmulation.js:375: function getVisibleContent(element) On 2019/03/12 08:44:01, Manish Jethani wrote: > ...
March 12, 2019, 9:29 a.m. (2019-03-12 09:29:29 UTC) #4
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); On 2019/03/06 16:34:11, hub wrote: ...
March 12, 2019, 12:24 p.m. (2019-03-12 12:24:10 UTC) #5
Manish Jethani
Also see my comment over here: https://issues.adblockplus.org/ticket/7337#comment:9 I think we should go with this syntax ...
March 12, 2019, 2 p.m. (2019-03-12 14:00:54 UTC) #6
hub
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); On 2019/03/12 12:24:09, Manish Jethani ...
March 14, 2019, 10:12 a.m. (2019-03-14 10:12:41 UTC) #7
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); On 2019/03/14 10:12:40, hub wrote: ...
March 14, 2019, 11:36 a.m. (2019-03-14 11:36:33 UTC) #8
hub
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); On 2019/03/14 11:36:33, Manish Jethani ...
March 20, 2019, 2:19 p.m. (2019-03-20 14:19:55 UTC) #9
hub
https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js File lib/content/elemHideEmulation.js (right): https://codereview.adblockplus.org/30024560/diff/30024561/lib/content/elemHideEmulation.js#newcode352 lib/content/elemHideEmulation.js:352: let style = window.getComputedStyle(element); On 2019/03/20 14:19:55, hub wrote: ...
March 20, 2019, 4:31 p.m. (2019-03-20 16:31:11 UTC) #10
hub
This is the snippet approach. I need to have a wider test coverage, and I ...
April 5, 2019, 9:06 p.m. (2019-04-05 21:06:06 UTC) #11
Manish Jethani
On 2019/04/05 21:06:06, hub wrote: > This is the snippet approach. I need to have ...
April 8, 2019, 9:09 p.m. (2019-04-08 21:09:14 UTC) #12
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) I know the ...
April 9, 2019, 12:31 p.m. (2019-04-09 12:31:23 UTC) #13
hub
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/09 12:31:23, ...
April 10, 2019, 4:16 p.m. (2019-04-10 16:16:21 UTC) #14
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/10 16:16:21, ...
April 10, 2019, 4:39 p.m. (2019-04-10 16:39:23 UTC) #15
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/10 16:39:23, ...
April 10, 2019, 5:15 p.m. (2019-04-10 17:15:17 UTC) #16
hub
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/10 16:39:23, ...
April 10, 2019, 7:40 p.m. (2019-04-10 19:40:05 UTC) #17
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/10 19:40:05, ...
April 10, 2019, 7:48 p.m. (2019-04-10 19:48:20 UTC) #18
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode921 lib/content/snippets.js:921: function hideIfContainsVisibleText(search, hideSelector, innerSelector = null) On 2019/04/10 19:48:20, ...
April 10, 2019, 7:58 p.m. (2019-04-10 19:58:53 UTC) #19
hub
On 2019/04/10 19:58:53, Manish Jethani wrote: > To give an example of what I'm saying, ...
April 17, 2019, 4:02 a.m. (2019-04-17 04:02:21 UTC) #20
Manish Jethani
On 2019/04/17 04:02:21, hub wrote: > On 2019/04/10 19:58:53, Manish Jethani wrote: > > > ...
April 17, 2019, 6:32 a.m. (2019-04-17 06:32:31 UTC) #21
Manish Jethani
On 2019/04/17 06:32:31, Manish Jethani wrote: > Basically the idea is to use a regular ...
April 17, 2019, 1:21 p.m. (2019-04-17 13:21:46 UTC) #22
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode908 lib/content/snippets.js:908: Nit: Maybe a good idea to group all the ...
April 17, 2019, 1:54 p.m. (2019-04-17 13:54:26 UTC) #23
hub
Reworked patch https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode908 lib/content/snippets.js:908: On 2019/04/17 13:54:26, Manish Jethani wrote: > ...
April 17, 2019, 5:25 p.m. (2019-04-17 17:25:07 UTC) #24
hub
https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js#newcode543 lib/content/snippets.js:543: makeInjector(hideIfContainsVisibleText, hideIfMatch, hideElement); It doesn't need to be a ...
April 17, 2019, 5:27 p.m. (2019-04-17 17:27:03 UTC) #25
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode933 lib/content/snippets.js:933: style = window.getComputedStyle(element); On 2019/04/17 17:25:06, hub wrote: > ...
April 17, 2019, 6:33 p.m. (2019-04-17 18:33:29 UTC) #26
hub
https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30039555/lib/content/snippets.js#newcode984 lib/content/snippets.js:984: innerSelector ? element.querySelectorAll(innerSelector) : [element]; On 2019/04/17 18:33:28, Manish ...
April 17, 2019, 6:40 p.m. (2019-04-17 18:40:35 UTC) #27
Manish Jethani
Aside from the nits, the implementation is looking great. I'll look at the test files ...
April 17, 2019, 6:52 p.m. (2019-04-17 18:52:36 UTC) #28
hub
Updated patch https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js#newcode416 lib/content/snippets.js:416: * @param {string?} [searchSelector] The CSS selector ...
April 17, 2019, 9:38 p.m. (2019-04-17 21:38:07 UTC) #29
Manish Jethani
https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30047560/lib/content/snippets.js#newcode535 lib/content/snippets.js:535: hideIfMatch(element => On 2019/04/17 21:38:06, hub wrote: > On ...
April 18, 2019, 8:40 a.m. (2019-04-18 08:40:43 UTC) #30
Manish Jethani
Minus the one nit, the change in `lib/*` looks good to me. For the test ...
April 18, 2019, 1:34 p.m. (2019-04-18 13:34:44 UTC) #31
hub
updated patch. https://codereview.adblockplus.org/30024560/diff/30047579/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30047579/lib/content/snippets.js#newcode460 lib/content/snippets.js:460: selector, searchSelector); On 2019/04/18 08:40:43, Manish Jethani ...
April 18, 2019, 5:48 p.m. (2019-04-18 17:48:41 UTC) #32
Manish Jethani
LGTM for the changes in `lib/*` Andrea: For `test/*`, it would be great if you ...
April 19, 2019, 9:23 a.m. (2019-04-19 09:23:14 UTC) #33
Manish Jethani
April 19, 2019, 9:24 a.m. (2019-04-19 09:24:07 UTC) #34
a.giammarchi
Overall not bad, but I have a couple of questions I'd like to be addressed ...
April 26, 2019, 1:34 p.m. (2019-04-26 13:34:00 UTC) #35
a.giammarchi
Oooops, forgot one question https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js#newcode517 lib/content/snippets.js:517: shouldn't `clientWidth` and `clientHeight` be ...
April 26, 2019, 1:51 p.m. (2019-04-26 13:51:07 UTC) #36
hub
Updated patch. I'll address clienthHeight / clientWidth on the next iteration. https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js File lib/content/snippets.js (right): ...
April 27, 2019, 5:32 p.m. (2019-04-27 17:32:06 UTC) #37
a.giammarchi
https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js#newcode438 lib/content/snippets.js:438: .observe(document, {childList: true, characterData: true, subtree: true}); On 2019/04/27 ...
April 29, 2019, 7:27 a.m. (2019-04-29 07:27:26 UTC) #38
hub
https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js#newcode535 lib/content/snippets.js:535: let re = toRegExp(search); On 2019/04/29 07:27:25, a.giammarchi wrote: ...
April 29, 2019, 1:03 p.m. (2019-04-29 13:03:47 UTC) #39
hub
https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30048561/lib/content/snippets.js#newcode438 lib/content/snippets.js:438: .observe(document, {childList: true, characterData: true, subtree: true}); On 2019/04/29 ...
April 29, 2019, 3:20 p.m. (2019-04-29 15:20:56 UTC) #40
a.giammarchi
not sure if you want to address now the `clientWidth` and `clientHeight` part, but since ...
April 29, 2019, 3:31 p.m. (2019-04-29 15:31:11 UTC) #41
hub
clientWidth / clientHeight has issue where some elements default to 0,0, so it needs more ...
April 29, 2019, 6:24 p.m. (2019-04-29 18:24:26 UTC) #42
hub
updated patch https://codereview.adblockplus.org/30024560/diff/30051555/test/browser/snippets.js File test/browser/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30051555/test/browser/snippets.js#newcode353 test/browser/snippets.js:353: expectHidden(test, element, "article"); On 2019/04/29 18:24:26, hub ...
April 30, 2019, 4:08 p.m. (2019-04-30 16:08:33 UTC) #43
hub
I have made changes (patch 12) to fix an issue that deserve an extra review ...
May 7, 2019, 6:06 p.m. (2019-05-07 18:06:48 UTC) #44
a.giammarchi
Added some major concern over current implementation of `isVisible`, please have a look, thanks. https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js ...
May 8, 2019, 9:43 a.m. (2019-05-08 09:43:48 UTC) #45
hub
updated patch https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js#newcode527 lib/content/snippets.js:527: return isVisible(element.parentNode, null, closest); On 2019/05/08 09:43:47, ...
May 8, 2019, 5:03 p.m. (2019-05-08 17:03:42 UTC) #46
a.giammarchi
clarified which issue might happen with current implementation https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js#newcode527 lib/content/snippets.js:527: return ...
May 9, 2019, 8:58 a.m. (2019-05-09 08:58:59 UTC) #47
hub
Really updated patch this time. https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js File lib/content/snippets.js (right): https://codereview.adblockplus.org/30024560/diff/30052555/lib/content/snippets.js#newcode527 lib/content/snippets.js:527: return isVisible(element.parentNode, null, closest); ...
May 9, 2019, 12:06 p.m. (2019-05-09 12:06:27 UTC) #48
a.giammarchi
May 10, 2019, 8:36 a.m. (2019-05-10 08:36:14 UTC) #49
LGTM

Powered by Google App Engine
This is Rietveld