Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ScienceSkyOfficiel committed Jan 3, 2021
1 parent 4935a9a commit ad65d4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Here a table recapitulating the possible parameters to pass to `SearchModule`:

If we keep the above example, we search among the elements that have the class "item". In order for the search bar to work properly, you absolutely need to add a specific attribute to each HTML element that has this class. If you don't do this, an exception will be thrown. This attribute is: `data-keywords`. In this attribute you can write the list of keywords that correspond to each item.

If an element doesn't have the attribute, an error will be thrown in the console (via `console.error()`). Therefore, this element will always be displayed whereas it does'nt correspond to what the user is looking at.

For example, we have a list of fruits:

```
Expand All @@ -60,7 +62,7 @@ For example, we have a list of fruits:

Therefore, if the user writes "apple", only the last item will be displayed. However, if the user writes "framboise" or "strawberry", then the second element will be displayed.

For more details, I invite you to look at the example provided in the `src` folder.
For a concrete example, I invite you to look at the example provided in the `src` folder.

## License

Expand Down
1 change: 0 additions & 1 deletion src/SearchModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
this.items = options.items;
this.defaultDisplay = options.defaultDisplay || "block";
this.oninput = options.oninput;
this.onEnterKey = options.onEnterKey;

if (!this.input || !this.items) {
throw new Error("SearchModule(options) : input parameter and items parameter cannot be null.");
Expand Down

0 comments on commit ad65d4f

Please sign in to comment.