Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In 'HTMLElement.classList.toggle' the 'force' attribute works uncorrectly. #277

Open
orangebokov opened this issue Jun 8, 2024 · 0 comments

Comments

@orangebokov
Copy link

export const toggle = <T extends HTMLElement> (className:string, force?:boolean) => (el:T) : boolean => el.classList.toggle(className, force)

toggle(className)(el)

In this example, if the 'force' attribute is not passed to the 'toggle' function, 'linkedom' will interpret it as being passed an attribute equal to 'undefined' and identify it as a 'false' value.

The correct way is for 'linkedom' to ignore the 'force' attribute if it is 'undefined'.

Everything works fine in the browser.

Аnd also in 'linkedom' everything works correctly if I do this check myself:

export const toggle = <T extends HTMLElement> (className:string, force?:boolean) => (el:T) : boolean => force === undefined ? el.classList.toggle(className) : el.classList.toggle(className, force)
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

No branches or pull requests

1 participant