Skip to content

Conversation

@Klustre
Copy link
Member

@Klustre Klustre commented Jan 18, 2022

While using aeq(SelectorString) it threw an error if the object didn't have the prop I was filtering (guideLayer=true which isn't present on Camera Layers for instance). So it broke the selector instead of silently ignoring it.

@runegan
Copy link
Member

runegan commented Jan 22, 2022

I think this could work well. That line has been there from the beginning, not sure what the reasoning behind it is, but it might be useful in some cases where you write the wrong attribute name for something?

But yeah, i think it can be removed without any issues.

@Klustre
Copy link
Member Author

Klustre commented Jan 25, 2022

@runegan Thanks for the review. On a similar note, it throws when the selector is "layer[lightType=" + LightType.PARALLEL + "]". This is unexpected, because lightType is (weirdly) present on all AV Layers. IMO using a SelectorString shouldn't throw at all. No matter what property you define. What do you think?

@rafikhan
Copy link

The intention behind a check like this is to help the developer not use an impossible selector on the DOM. If it’s removed you lose that safety net.

CSS selectors don't have this check and it is okay b/c the dom can change a lot. This isn’t true in AE.

Personally I say keep it but I don’t use it enough to see it as a problem either.

@rafikhan
Copy link

Another solution is to make "strict checking" an option on select that defaults to false?

@zlovatt
Copy link
Member

zlovatt commented Sep 5, 2024

@rafikhan @Klustre @runegan Any feelings on this, a year later? :)

@rafikhan
Copy link

rafikhan commented Sep 5, 2024 via email

@zlovatt
Copy link
Member

zlovatt commented Sep 5, 2024

I don't use selectors at all, so also not able to chime in with usage thoughts.

@Klustre
Copy link
Member Author

Klustre commented Sep 5, 2024

Same opinion; it doesn't make sense that it throws. I also haven't used aequery in the last 2 years.

But the reasoning behind it is pretty simple: when you use the query selector to get all layers with guideLayer=true, do you expect an error because certain layers don't have that prop or do you expect an array with all layers that have that prop set to true or otherwise an empty array if none can be found?

@rafikhan
Copy link

rafikhan commented Sep 5, 2024 via email

@zlovatt zlovatt merged commit c2fff44 into develop Sep 5, 2024
zlovatt added a commit that referenced this pull request Sep 5, 2024
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.

4 participants