From bf5ba5d76b62dd2ea6fc84cebe12714bfd9e8a1b Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 12 Mar 2017 17:48:49 +1000 Subject: [PATCH 1/2] Add filter by 'data-text' attr Sometimes li items contain rich HTML and much data, 'data-text' attr will help in such cases --- jquery.fastLiveFilter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.fastLiveFilter.js b/jquery.fastLiveFilter.js index bd53494..091804d 100644 --- a/jquery.fastLiveFilter.js +++ b/jquery.fastLiveFilter.js @@ -33,7 +33,7 @@ jQuery.fn.fastLiveFilter = function(list, options) { for (var i = 0; i < len; i++) { li = lis[i]; innerText = !options.selector ? - (li.textContent || li.innerText || "") : + (li.dataset.text || li.textContent || li.innerText || "") : $(li).find(options.selector).text(); if (innerText.toLowerCase().indexOf(filter) >= 0) { From 5097247e6bef0d14bdcd0945d5fa3c9858f2942d Mon Sep 17 00:00:00 2001 From: Roman Date: Sun, 12 Mar 2017 17:56:00 +1000 Subject: [PATCH 2/2] Add 'data-text' note --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b80b046..da829e7 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ The above would work with this HTML:
  • Two
  • Three
  • +**Note**: in case there is a rich content inside li items, attribute **data-text** can be set for each item and it's used for filtering as the most priority. Options -------