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

search for dynamic css? #14

Open
joereynolds opened this issue Apr 11, 2018 · 3 comments
Open

search for dynamic css? #14

joereynolds opened this issue Apr 11, 2018 · 3 comments

Comments

@joereynolds
Copy link
Owner

joereynolds commented Apr 11, 2018

For example, if it finds something like

.img-file-pdf
.img-file-css
.img-file-jpg
.img-file-png
.img-file-bmp

Maybe it should warn

Multiple classes found with prefix '.img-file', is this dynamically generated?`

Or it could keep backtracking and searching for img-file-pdf, img-file-pd img-file-d etc...
until it gets a match?

@joereynolds
Copy link
Owner Author

Here are some examples of dynamic CSS

This is a dumping ground of how people are using CSS dynamically which may get through mort

1.

var class = 'time-' + ( j == 1 ? 'start' : 'end' ) + '-cell';


2.

997: var a = "<div class='" + ((data.overdue == 1) ? 'task-overdue' : 'task-current' ) + "-hover-header'>" + data.action + " ( " + data.something + " ) " +
1001: "<div class='" + ((data.overdue == 1) ? 'task-overdue' : 'task-current' ) + "-hover-id'>thing1" +
1002: "<div class='" + ((data.overdue == 1) ? 'task-overdue' : 'task-current' ) + "-hover-value'> " + data.something + " ( " + data.thing + " )" +
1008: "<div class='" + ((data.overdue == 1) ? 'task-overdue' : 'task-current' ) + "-hover-id'>thing2" +
1009: "<div class='" + ((data.overdue == 1) ? 'task-overdue' : 'task-current' ) + "-hover-value'> " + data.thing + " ( " + data.thing + " )"

@joereynolds
Copy link
Owner Author

I would leave this to the user's discretion.

@joereynolds
Copy link
Owner Author

joereynolds commented Jun 5, 2018

Maybe we can list "possible" matches by doing something like

rg yoursearch.*andtherestofit

Maybe as a first pass, we can do something like the following

  • Create a function in selector.ts called (something like) isProbablyDynamic this should return a bool if you guessed it, the selector looks dynamic.
  • In getFrom in selectors.ts call this and create a new function in all the grep programs to search for this selector (or maybe use the existing call function but pass through a different selector name

How does a selector look dynamic? For now we can go with keywords like hover, start, end. This will be a hardcoded string which in the future can either go in as a config, or ideally, we can offer a better soution.

Grepping for it:

Example selector: my-box-hover

Example pattern: my-box.*hover

The more examples of dynamic css we can get, the better.

Questions

Should we bother doing the exact string match if a selector looks dynamic?
It's a wasted call.

@joereynolds joereynolds reopened this Jun 6, 2018
@joereynolds joereynolds changed the title Recommend possible use of dynamic css? search for dynamic css? Jun 6, 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

No branches or pull requests

1 participant