Skip to content

fix(curriculum-helpers): fixed CSSHELP issue with getStyleAny #584

Open
TEE0207 wants to merge 1 commit into
freeCodeCamp:mainfrom
TEE0207:CSSHelp_issue_with_getStyleAny
Open

fix(curriculum-helpers): fixed CSSHELP issue with getStyleAny #584
TEE0207 wants to merge 1 commit into
freeCodeCamp:mainfrom
TEE0207:CSSHelp_issue_with_getStyleAny

Conversation

@TEE0207
Copy link
Copy Markdown

@TEE0207 TEE0207 commented May 13, 2026

by modifying docs/css.md, packages/helpers/lib/index.ts and packages/tests/css-helper.test.ts"

Checklist:

Closes freeCodeCamp/freeCodeCamp#64218

@TEE0207 TEE0207 requested a review from a team as a code owner May 13, 2026 20:44
@majestic-owl448
Copy link
Copy Markdown
Contributor

is this PR related to an issue? Please link to the issue, or create one first to discuss the changes.

@TEE0207
Copy link
Copy Markdown
Author

TEE0207 commented May 14, 2026

is this PR related to an issue? Please link to the issue, or create one first to discuss the changes.

Alright, yes it is... here's the link to the issue I fixed.
freeCodeCamp/freeCodeCamp#64218

@TEE0207 TEE0207 changed the title fixed CSSHELP issue with getStyleAny fix(curriculum-helpers): fixed CSSHELP issue with getStyleAny May 14, 2026
@majestic-owl448
Copy link
Copy Markdown
Contributor

majestic-owl448 commented May 14, 2026

please make sure the issue is linked in the appropriate place in the template

Closes #XXXXX

as the issue is in a different repository, use the whole link in place of #XXXXX

Copy link
Copy Markdown
Contributor

@majestic-owl448 majestic-owl448 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, but this approach is not the right fix for this issue.

getStyleAny is designed to accept a list of interchangeable selectors and return the style for whichever one the learner actually used. Requiring that ALL selectors in the list exist in the CSS breaks that contract: a learner who correctly uses one of the allowed selectors would have their solution rejected because the others aren't present.

The actual bug is in getStyle: when the CSS contains a rule with a universal selector (*), getStyle can match it against a query that doesn't use * (because some browsers normalize *:first-of-type to :first-of-type in selectorText). The fix should go in getStyle, checking whether the rule's selectorText contains a universal selector and skipping it when the queried selector does not.

Also, please link the issue properly in the PR template. Since the issue is in a different repository, use the full URL instead of #XXXXX:

Closes https://github.com/freeCodeCamp/freeCodeCamp/issues/64218

@TEE0207 TEE0207 requested a review from majestic-owl448 May 15, 2026 10:01
…es/helpers/lib/index.ts and packages/tests/css-helper.test.ts

Signed-off-by: TEE0207 <taofeeklwl@gmail.com>

fixed CSSHELP issue with getStyle by modifying docs/css.md, packages/helpers/lib/index.ts and packages/tests/css-helper.test.ts

Signed-off-by: TEE0207 <taofeeklwl@gmail.com>

chore: ignore macOS .DS_Store files (freeCodeCamp#579)

fix: functionRegex no longer replaces empty parameter (freeCodeCamp#581)

* fix: function Regex now returns empty array for empty function parameters

* Remove extraneous changes

* Apply suggestions from code review

Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com>
Signed-off-by: Anna  <a.rcottrill521@gmail.com>

---------

Signed-off-by: Anna  <a.rcottrill521@gmail.com>
Co-authored-by: majestic-owl448 <26656284+majestic-owl448@users.noreply.github.com>
@TEE0207 TEE0207 force-pushed the CSSHelp_issue_with_getStyleAny branch from b9a1f3f to 8e1702e Compare May 18, 2026 08:58
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.

CSSHelp issue with getStyleAny

2 participants