
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
jquery-bem-utils
Advanced tools
Simple BEM integration in jQuery.
npm i --save-dev jquery-bem-utils
var $ = require('jquery');
require('jquery-bem-utils');
Your BEM has to be in the style of block__element--modifier for this plugin to work.
Find Block
findBlock(elementName)
$('body').findBlock('foo'); // => returns $('.foo--red--padding-large')
<body>
<div class="foo--red--padding-large">
<div class="foo__bar"></div>
</div>
</body>
Find Element
findElement(elementName)
$('body').findBlock('foo').findElement('bar'); // => returns $('.foo__bar')
<body>
<div class="foo--red--padding-large">
<div class="foo__bar"></div>
</div>
</body>
Get Modifiers
$('body').findBlock('foo').getModifiers(); // => returns ['red', 'padding-large']
<body>
<div class="foo--red--padding-large">
<div class="foo__bar"></div>
</div>
</body>
Has Modifier
hasModifier(modifierName)
$('body').findBlock('foo').hasModifier('red'); // => returns true
$('body').findBlock('foo').hasModifier('bar'); // => returns false
<body>
<div class="foo--red--padding-large">
<div class="foo__bar--bar"></div>
<div class="foo__bar--bar"></div>
<div class="foo__bar--bar"></div>
</div>
</body>
Set Modifier
addModifier(modifierName, unique)
$('body').findBlock('foo').findElement('bar').addModifier('hello'); // => returns (1)
$('body').findBlock('foo').findElement('bar').filter(':nth-child(2)').addModifier('hello', true); // => returns (2)
$('body').findBlock('foo').findElement('bar').filter(':nth-child(3)').addModifier('hello', true); // => returns (3)
(1)
<body>
<div class="foo--red--padding-large">
<div class="foo__bar--bye--hello"></div>
<div class="foo__bar--bye--hello"></div>
<div class="foo__bar--bye--hello"></div>
</div>
</body>
(2)
<body>
<div class="foo--red--padding-large">
<div class="foo__bar--bye"></div>
<div class="foo__bar--bye--hello"></div>
<div class="foo__bar--bye"></div>
</div>
</body>
(3)
<body>
<div class="foo--red--padding-large">
<div class="foo__bar--bye"></div>
<div class="foo__bar--bye"></div>
<div class="foo__bar--bye--hello"></div>
</div>
</body>
FAQs
Package to add support for BEM to jQuery
The npm package jquery-bem-utils receives a total of 1 weekly downloads. As such, jquery-bem-utils popularity was classified as not popular.
We found that jquery-bem-utils 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.