News for hackers. Stuff that matters.
Re:Client-side full text search in CSS by mannix on Tuesday September 10, 2013 @06:15PM (#6363918)
You don't need to use javascript to hide/show matching elements. He also mentions something about it being faster than just an indexOf(), but gives no real benchmarks, so take that with a grain of salt.
Re:Client-side full text search in CSS by mannix on Tuesday September 10, 2013 @06:18PM (#6363942)
(Rereading again..) The JS claim is silly. He is saying that because we are dynamically creating a single style, that show/hide logic will be faster. I disagree with this, since adding a CSS selector to the page means the page needs to rematch that new selector against every element of the page and re-render each matching element, same as if we had just changed the matching elements with javascript.

EDIT: thinking on this some more, it actually should be a bit faster for huge collections, since javascript has to update items individually, whereas the browser has probably optimized this code path.

Re:Client-side full text search in CSS by kevincennis on Tuesday September 10, 2013 @07:46PM (#6364399)
Well, it's fewer DOM manipulations, right? Touch a single style element vs updating a bunch of them.
Re:Client-side full text search in CSS by mannix on Tuesday September 10, 2013 @10:28PM (#6365117)
It's fewer DOM manipulations from Javascript yes. The browser will still internally change the styles associated with the DOM elements, just without the JS overhead.