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

Fix $= selector #135

Merged
merged 2 commits into from
Dec 11, 2018
Merged

Fix $= selector #135

merged 2 commits into from
Dec 11, 2018

Conversation

dstillman
Copy link
Contributor

Zest's $= check used indexOf() without checking for -1 and then did a
length check, so if the test string happened to be one character longer
than the attribute value, it returned true, even if the string didn't
match.

Nothing really to put in a test here, since this was just an edge case.

Zest's $= check used indexOf() without checking for -1 and then did a
length check, so if the test string happened to be one character longer
than the attribute value, it returned true, even if the string didn't
match.
@cscott
Copy link
Collaborator

cscott commented Dec 10, 2018

Even though a test case seems trivial, it would be appreciated. Just add a simple doc and a document.querySelector() call that fails without this patch but succeeds with it...

@dstillman
Copy link
Contributor Author

It's not that a test is trivial — it's just that the bug here was a random coding error that would be very unlikely to be reproduced in new code, and adding a test for every possible permutation of how something could hypothetically be broken isn't necessarily desirable. Anyhow, I've added a test.

@cscott
Copy link
Collaborator

cscott commented Dec 10, 2018

I agree -- it's just that tests are also useful documentation for what was fixed and why. Someone trying to figure out if this bug could have affected them might be helped by seeing an example, for instance. And it also helps convince the maintainer that your patch does what it says on the tin -- my human eyes are most easily tricked by patches which look "obviously correct", so those are the ones I like especially to see test cases for.

@cscott cscott merged commit 513aeec into fgnass:master Dec 11, 2018
cscott added a commit that referenced this pull request Dec 11, 2018
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.

2 participants