
Research
/Security News
jscrambler npm Package Compromised in Supply Chain Attack
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.
datalist-css
Advanced tools
This JavaScript module allows you to style HTML5 <datalist> and child <option> elements using standard CSS. Load demo.html to view the demonstration page.
HTML5 <datalist> elements cannot be styled. To achieve it, this 1.5Kb script overrides the browser's default behavior; the <datalist> effectively becomes a <div>. It's little different to using a JavaScript-based autocomplete control since all display and input handling must be managed manually.
This script was primarily written for demonstration purposes and it's probably best avoided!...
<datalist>.Load the script anywhere in your HTML page as an ES6 module:
<script type="module" src="./dist/datalist-css.min.js"></script>
or using the CDN:
<script src="https://cdn.jsdelivr.net/npm/datalist-css/dist/datalist-css.min.js"></script>
Create a standard text <input> immediately followed by a <datalist> containing one or more <option> elements, e.g.
<label for="browser">browser:</label>
<input list="browserdata" id="browser" name="browser" size="50" autocomplete="off" />
<datalist id="browserdata">
<option>Brave</option>
<option>Chrome</option>
<option>Edge</option>
<option>Firefox</option>
<option>Internet Explorer</option>
<option>Opera</option>
<option>Safari</option>
<option>Vivaldi</option>
<option>other</option>
</datalist>
Note:
list attribute must reference the id of the <datalist>.autocomplete="off" to ensure the input does not show previously values entered by the user.<option>value</option> format can be used (<option value="value" /> is an empty element which cannot be styled).Add CSS to style all <datalist> and <option> elements, e.g.
datalist {
position: absolute;
max-height: 20em;
border: 0 none;
overflow-x: hidden;
overflow-y: auto;
}
datalist option {
font-size: 0.8em;
padding: 0.3em 1em;
background-color: #ccc;
cursor: pointer;
}
/* option active styles */
datalist option:hover, datalist option:focus {
color: #fff;
background-color: #036;
outline: 0 none;
}
The minified script is built using Rollup.js and Terser. Install globally:
npm install -g rollup rollup-plugin-terser
If not done already, set NODE_PATH to the npm root folder so global modules can be used within any project directory, e.g.
export NODE_PATH=$(npm root --quiet -g)
Build using:
npm run build
FAQs
Style HTML5 datalist elements using standard CSS
The npm package datalist-css receives a total of 30 weekly downloads. As such, datalist-css popularity was classified as not popular.
We found that datalist-css demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.

Security News
/Research
Compromised Injective SDK npm version 1.20.21 exfiltrates wallet private keys and mnemonics through fake telemetry functionality.