Skip to content

Conversation

icodebyamanda
Copy link

@icodebyamanda icodebyamanda commented Oct 17, 2025

Asana Task/Github Issue: https://app.asana.com/1/137249556945/project/72649045549333/task/1211479926220519?focus=true

Description

  • Add JSDoc type definitions matching element-hiding.ts schema
  • Cast getFeatureSetting return values to proper types with fallbacks
  • Update function parameter types to use new JSDoc types
  • Add type guards for union types (ElementHidingRule)
  • Preserve all original comments from codebase
  • Fix TypeScript compilation errors with proper null checks

This integrates the refactored schema types from privacy-configuration into the content-scope-scripts element-hiding feature for better type safety and maintainability.

Testing Steps

Checklist

Please tick all that apply:

  • [x ] I have tested this change locally
  • [x ] I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

Note

Adds JSDoc typedefs and applies safer defaults and guards (for missing selector/values) across element-hiding logic.

  • Types:
    • Add JSDoc typedefs: ElementHidingValue, ElementHidingRuleWithSelector, ElementHidingRuleWithoutSelector, ElementHidingRule, ElementHidingDomain, StyleTagException, ElementHidingConfiguration.
    • Update function params to use ElementHidingRule/ElementHidingValue and related types.
  • Runtime guards:
    • Only process rules with selector in injectStyleTag and hideAdNodes.
    • Check rule.values before calling modify-attr/modify-style.
  • Initialization defaults:
    • Cast getFeatureSetting returns with explicit defaults for rules, adLabelStrings, useStrictHideStyleTag, hideTimeouts, unhideTimeouts, mediaAndFormSelectors.
  • Docs/annotations:
    • Improve JSDoc for functions (collapseDomNode, expandNonEmptyDomNode, modifyAttribute, modifyStyle, extractTimeoutRules, injectStyleTag, hideAdNodes, applyRules).

Written by Cursor Bugbot for commit 8247dc4. This will update automatically on new commits. Configure here.

- Add JSDoc type definitions matching element-hiding.ts schema
- Cast getFeatureSetting return values to proper types with fallbacks
- Update function parameter types to use new JSDoc types
- Add type guards for union types (ElementHidingRule)
- Preserve all original comments from codebase
- Fix TypeScript compilation errors with proper null checks

This integrates the refactored schema types from privacy-configuration
into the content-scope-scripts element-hiding feature for better
type safety and maintainability.
@icodebyamanda icodebyamanda requested a review from a team as a code owner October 17, 2025 14:02
Copy link

netlify bot commented Oct 17, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit 8247dc4
🔍 Latest deploy log https://app.netlify.com/projects/content-scope-scripts/deploys/68f6288446ae7a000836bddb
😎 Deploy Preview https://deploy-preview-2016--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

github-actions bot commented Oct 17, 2025

[Beta] Generated file diff

Time updated: Mon, 20 Oct 2025 12:19:09 GMT

Android
    - android/contentScope.js

File has changed

Apple
    - apple/contentScope.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

Copy link

github-actions bot commented Oct 17, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

selector = selector.concat(rule.selector, ',');
} else {
selector = selector.concat(rule.selector);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: CSS Injection Fails with Missing Selectors

The injectStyleTag function can generate invalid CSS. When rules without a selector property are present, the logic for building the selector string skips them but still uses the original array index for comma placement. This can result in an empty selector string or trailing commas, leading to malformed CSS like :is() {}.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants