Skip to content

IN operator now returns false if string indexer is used to search for property and returns null #105

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

arekdygas
Copy link
Contributor

@arekdygas arekdygas commented Apr 14, 2025

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

Fixes #104.

When IN operator is used to search for property in an object and that object doesn't have the property, but has string indexer, then the indexer is used to look for property. Before fix, even if indexer returned null, i.e. "doesn't exist", IN returned true.

A few additional tests for IN operator were added as well, just to be sure if this change didn't break anything.

@CLAassistant
Copy link

CLAassistant commented Apr 14, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@FlorianRappl FlorianRappl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks a lot!

@FlorianRappl FlorianRappl added this to the v1.0 milestone Apr 14, 2025
@FlorianRappl FlorianRappl merged commit e5f859a into AngleSharp:devel Apr 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JS 'in' operator always return true for objects whose types have string indexers
3 participants