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

Internal functions occasionally make invalid css queries #15

Open
sritchie opened this issue Mar 31, 2022 · 0 comments
Open

Internal functions occasionally make invalid css queries #15

sritchie opened this issue Mar 31, 2022 · 0 comments

Comments

@sritchie
Copy link
Collaborator

Some internal mathbox functions query Mathbox's DOM using invalid CSS selector queries.

For example:

  1. Edit Mathbox source at https://gitgud.io/unconed/mathbox/-/blob/master/src/model/model.js#L322 to console.log its first argument, a css selector query.
  2. Rebuild, and load examples/test/rtt.html

You will find that one of the queries logged to console is the string

vec4 getSample(vec2 xy);
vec4 getFramesSample(vec2 xy) { return getSample(xy); }

which is clearly not a valid css selector query.

Do we care?

Probably not right now.

I suspect Mathbox has always made these invalid queries, and the css-selection library cssauron tolerated them fine: it would just return false since no elements matched these invalid selectors. These invalid queries seem not to be causing any bugs.

I discovered this while working on replacing cssauron with css-select. The new library, css-select, is a bit stricter in that it throws errors when passed invalid css selectors. This error-throwing behavior seems desirable to me. (For one thing, it's consistent with the browser-native Element.querySelector API.)

Embracing the new error-throwing behavior probably requires preventing Mathbox internal functions from making these invalid CSS queries.

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