Skip to content

Fix dislike count not rendering after LeetCode icon markup change - #9

Open
pseudo-bot wants to merge 1 commit into
bunnykek:mainfrom
pseudo-bot:bug/fix-dislike-button
Open

Fix dislike count not rendering after LeetCode icon markup change#9
pseudo-bot wants to merge 1 commit into
bunnykek:mainfrom
pseudo-bot:bug/fix-dislike-button

Conversation

@pseudo-bot

Copy link
Copy Markdown

What

Updated the thumbs-up/down selectors to match LeetCode's current DOM.

Why

LeetCode's dynamic layout no longer renders the data-icon attribute on the thumb SVGs — the icon is now identified only by the FontAwesome class (fa-thumbs-up / fa-thumbs-down). As a result querySelector('[data-icon="thumbs-down"]') returned null, the count div was never injected, and the dislike count stopped showing. (Like/dislike values still logged because the fetch runs before the DOM step.)

Change

  • THUMBS_UP_SELECTOR'svg.fa-thumbs-up, [data-icon="thumbs-up"]'
  • THUMBS_DOWN_SELECTOR'svg.fa-thumbs-down, [data-icon="thumbs-down"]'

Kept the legacy [data-icon=...] selector as a fallback for backward compatibility.

Testing

  • Load unpacked at chrome://extensions
  • Open a leetcode.com/problems/* page
  • Dislike count now renders next to the thumbs-down button

## What
Updated the thumbs-up/down selectors to match LeetCode's current DOM.

## Why
LeetCode's dynamic layout no longer renders the `data-icon` attribute on the
thumb SVGs — the icon is now identified only by the FontAwesome class
(`fa-thumbs-up` / `fa-thumbs-down`). As a result `querySelector('[data-icon="thumbs-down"]')`
returned `null`, the count div was never injected, and the dislike count stopped showing.
(Like/dislike values still logged because the fetch runs before the DOM step.)

## Change
- `THUMBS_UP_SELECTOR`  → `'svg.fa-thumbs-up, [data-icon="thumbs-up"]'`
- `THUMBS_DOWN_SELECTOR` → `'svg.fa-thumbs-down, [data-icon="thumbs-down"]'`

Kept the legacy `[data-icon=...]` selector as a fallback for backward compatibility.

## Testing
- Load unpacked at `chrome://extensions`
- Open a `leetcode.com/problems/*` page
- Dislike count now renders next to the thumbs-down button
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.

1 participant