fix(curriculum-helpers): fixed CSSHELP issue with getStyleAny #584
fix(curriculum-helpers): fixed CSSHELP issue with getStyleAny #584TEE0207 wants to merge 1 commit into
Conversation
|
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. |
|
please make sure the issue is linked in the appropriate place in the template
as the issue is in a different repository, use the whole link in place of |
majestic-owl448
left a comment
There was a problem hiding this comment.
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
…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>
b9a1f3f to
8e1702e
Compare
by modifying docs/css.md, packages/helpers/lib/index.ts and packages/tests/css-helper.test.ts"
Checklist:
Update index.md)Closes freeCodeCamp/freeCodeCamp#64218