Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting, but I can't help feeling that a better implementation would be to split ethe input on white space, and build a slightly more complex selector such that a search for "term1 term2" would set the style to:

  .searchable { display: none; }
  .searchable[data-index*="term1"][date-index*="term2"] { display; block; }
and an empty input would hav eno selectors (or .searchable {display:block;} ).

It's slightly more code, but much more usable.



I ended up implementing it this way. Nice idea. Just FYI there's a typo on line two (display; block should be display: block).

Got stuck on that for about 5 minutes. That's what I get for copy pasting :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: