Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Internal functions occasionally make invalid css queries #15

@sritchie

Description

@sritchie

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions