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

impl PartialEq for web-sys #1672

Closed
dakom opened this issue Jul 17, 2019 · 1 comment · Fixed by #1673
Closed

impl PartialEq for web-sys #1672

dakom opened this issue Jul 17, 2019 · 1 comment · Fixed by #1673
Labels
help wanted We could use some help fixing this issue! web-sys Issues related to the `web-sys` crate

Comments

@dakom
Copy link
Contributor

dakom commented Jul 17, 2019

Motivation

PartialEq is implemented for things in js_sys: #1444

However, we still can't check for equality between web_sys::Element's for example.

Proposed Solution

Not sure if this is automatic via a single derive or in a macro or what, sorry! But on Discord @Pauan indicated that it's somehow doable.

Additional Context

For a use case - we currently can't check if Document.pointerLockElement is equal to the element that initiated getting pointer lock. Workarounds are possible (like setting an id and comparing that), but it's not idiomatic and it would be much nicer to have direct equality checks.

@dakom dakom added the enhancement New feature or request label Jul 17, 2019
@alexcrichton
Copy link
Contributor

Thanks for the report! I agree this is probably something we should enable by default, and would agree in doing so!

FWIW this might be pretty easy, perhaps as easy as simply changing this line!

@alexcrichton alexcrichton added help wanted We could use some help fixing this issue! web-sys Issues related to the `web-sys` crate and removed enhancement New feature or request labels Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We could use some help fixing this issue! web-sys Issues related to the `web-sys` crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants