Skip to content
This repository was archived by the owner on Oct 14, 2026. It is now read-only.

Commit 7094069

Browse files
committed
fix(html-analyzer): preserve authored map wrappers
Remove the author-controlled data-google-maps selector and update regression coverage to preserve content within those wrappers. Document why detached Google control selectors remain covered.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4a03497 commit 7094069

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎packages/spacecat-shared-html-analyzer/src/html-filter.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ const VIDEO_PLAYER_SELECTORS = [
105105
// Keep customer-authored location data around the map; strip only Google-owned widget nodes.
106106
const MAPS_WIDGET_SELECTORS = [
107107
'.gm-style', // Google Maps JS API root container
108-
'.LGLeeN-keyboard-shortcuts-view', // Google Maps keyboard shortcut overlay
108+
// Controls can be detached from .gm-style in serialized or partial DOM snapshots.
109+
'.LGLeeN-keyboard-shortcuts-view',
109110
'.gm-style-cc',
110111
'.gm-bundled-control',
111112
'.gm-svpc',
112113
'.gmnoprint',
113-
'[data-google-maps]',
114114
'gmp-map', // Google Maps Web Component (Maps JS API v4+)
115115
].join(', ');
116116

‎packages/spacecat-shared-html-analyzer/test/index.test.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
} from '../src/index.js';
2424

2525
function installBrowserDomParserShim() {
26+
// This minimal shim supports selector/removal behavior only; fixtures must not include scripts.
2627
const previous = {
2728
window: globalThis.window,
2829
document: globalThis.document,
@@ -456,7 +457,7 @@ describe('HTML Visibility Analyzer', () => {
456457
<p>Store locator fallback copy for visitors.</p>
457458
</div>
458459
<div data-google-maps>
459-
<span>Map data ©Google</span>
460+
<span>Customer-authored store locator content.</span>
460461
</div>
461462
<p>Visit us at our office.</p>
462463
</body></html>`;
@@ -468,7 +469,7 @@ describe('HTML Visibility Analyzer', () => {
468469
expect(text).to.include('How to use the Google Maps API for store locators.');
469470
expect(text).to.include('Our office locations are shown on a Google map.');
470471
expect(text).to.include('Store locator fallback copy for visitors.');
471-
expect(text).to.not.include('Map data ©Google');
472+
expect(text).to.include('Customer-authored store locator content.');
472473
});
473474

474475
it('should remove Google Maps widgets in browser DOMParser mode', async () => {

0 commit comments

Comments
 (0)