Skip to content

Commit 914d709

Browse files
josephperrottalxhub
authored andcommitted
build: remove usage of blacklist in benchmark tooling (angular#38926)
Removes the usage of blacklist in benchmark tooling, instead using more specificity to indicate whether a row is collapsible. PR Close angular#38926
1 parent e459dc7 commit 914d709

4 files changed

Lines changed: 17 additions & 18 deletions

File tree

modules/benchmarks/src/expanding_rows/expanding_row.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export interface ExpandingRowHostBase {
4545
handleRowSummaryClick(row: ExpandingRow): void;
4646

4747
/**
48-
* Check if element is blacklisted. Blacklisted elements will not collapse an
48+
* Check if element is collapsible. Elements marked as uncollapsible will not collapse an
4949
* open row when clicked.
5050
*/
51-
isBlacklisted(element: HTMLElement|null): boolean;
51+
isCollapsible(element: HTMLElement|null): boolean;
5252

5353
/**
5454
* Handles caption element click on a cfc-expanding-row component. Note
@@ -247,16 +247,15 @@ export class ExpandingRow {
247247
* notify click on its host element. Note that caption is only shown when
248248
* the row is expanded. Hence this will collapse this row and put the focus
249249
* on it.
250-
* If a blacklisted element exists in the caption, clicking that element will
250+
* If an uncollapsible element exists in the caption, clicking that element will
251251
* not trigger the row collapse.
252252
*/
253253
handleCaptionClick(event: MouseEvent): void {
254-
if (this.expandingRowHost.isBlacklisted(event.target as {} as HTMLElement)) {
255-
return;
254+
if (this.expandingRowHost.isCollapsible(event.target as {} as HTMLElement)) {
255+
this.expandingRowHost.handleRowCaptionClick(this);
256+
this.collapse();
257+
this.focus();
256258
}
257-
this.expandingRowHost.handleRowCaptionClick(this);
258-
this.collapse();
259-
this.focus();
260259
}
261260

262261
/**

modules/benchmarks/src/expanding_rows/expanding_row_host.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,18 +315,18 @@ export class ExpandingRowHost implements AfterViewInit, OnDestroy, ExpandingRowH
315315
}
316316

317317
/**
318-
* Check if element is blacklisted. Blacklisted elements will not collapse an
318+
* Check if element is collapsible. Elements marked as uncollapsible will not collapse an
319319
* open row when clicked.
320320
*/
321-
isBlacklisted(element: HTMLElement|null): boolean {
321+
isCollapsible(element: HTMLElement|null): boolean {
322322
const clickRoot = this.getClickRootElement();
323323
while (element && element !== clickRoot) {
324-
if (element.hasAttribute('cfcexpandingrowblacklist')) {
325-
return true;
324+
if (element.hasAttribute('cfcUncollapsible')) {
325+
return false;
326326
}
327327
element = element.parentElement;
328328
}
329-
return false;
329+
return true;
330330
}
331331

332332
/**

modules/benchmarks/src/expanding_rows/expanding_row_module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import {CommonModule} from '@angular/common';
1010
import {NgModule} from '@angular/core';
1111

1212
import {ExpandingRow} from './expanding_row';
13-
import {ExpandingRowBlacklist} from './expanding_row_blacklist';
1413
import {ExpandingRowDetailsCaption} from './expanding_row_details_caption';
1514
import {ExpandingRowDetailsContent} from './expanding_row_details_content';
1615
import {ExpandingRowHost} from './expanding_row_host';
1716
import {ExpandingRowSummary} from './expanding_row_summary';
17+
import {ExpandingRowUncollapsible} from './expanding_row_uncollapsible';
1818

1919
/** The main module for the cfc-expanding-row component. */
2020
@NgModule({
@@ -24,15 +24,15 @@ import {ExpandingRowSummary} from './expanding_row_summary';
2424
ExpandingRowDetailsContent,
2525
ExpandingRowHost,
2626
ExpandingRowSummary,
27-
ExpandingRowBlacklist,
27+
ExpandingRowUncollapsible,
2828
],
2929
exports: [
3030
ExpandingRow,
3131
ExpandingRowDetailsCaption,
3232
ExpandingRowDetailsContent,
3333
ExpandingRowHost,
3434
ExpandingRowSummary,
35-
ExpandingRowBlacklist,
35+
ExpandingRowUncollapsible,
3636
],
3737
imports: [
3838
CommonModule,

modules/benchmarks/src/expanding_rows/expanding_row_blacklist.ts renamed to modules/benchmarks/src/expanding_rows/expanding_row_uncollapsible.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {Directive} from '@angular/core';
1414
* expanded row
1515
*/
1616
@Directive({
17-
selector: '[cfcExpandingRowBlacklist]',
17+
selector: '[cfcUncollapsible]',
1818
})
19-
export class ExpandingRowBlacklist {
19+
export class ExpandingRowUncollapsible {
2020
}

0 commit comments

Comments
 (0)