Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
Dom7 is a minimalistic JavaScript library for DOM manipulation, designed to be used with frameworks like Framework7. It provides a simple and efficient API for common DOM operations such as element selection, event handling, and manipulation.
Element Selection
Dom7 allows you to select elements using a simple syntax similar to jQuery. The `$$` function is used to select all `div` elements in the document.
const $$ = Dom7;
const elements = $$('div');
Event Handling
Dom7 provides an easy way to attach event listeners to elements. In this example, a click event listener is added to all `button` elements, which triggers an alert when any button is clicked.
const $$ = Dom7;
$$('button').on('click', function() {
alert('Button clicked!');
});
Element Manipulation
Dom7 allows you to manipulate the content of elements. This example changes the text content of all `p` elements to 'New text content'.
const $$ = Dom7;
$$('p').text('New text content');
Class Management
Dom7 makes it easy to manage classes on elements. This example adds the class 'new-class' to all `div` elements.
const $$ = Dom7;
$$('div').addClass('new-class');
CSS Manipulation
Dom7 allows you to manipulate the CSS properties of elements. This example sets the text color of all `div` elements to red.
const $$ = Dom7;
$$('div').css('color', 'red');
jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, and animation much simpler with an easy-to-use API that works across a multitude of browsers. Compared to Dom7, jQuery is more feature-rich and widely used, but also larger in size.
Zepto is a minimalist JavaScript library for modern browsers with a largely jQuery-compatible API. It is lightweight and designed for mobile devices. Compared to Dom7, Zepto is similar in its minimalistic approach but is more focused on mobile performance.
Cash is a small library for modern browsers that provides jQuery-style syntax for manipulating the DOM. It is designed to be fast and lightweight. Compared to Dom7, Cash offers a similar API but is optimized for performance and size.
Dom7 - is the default DOM manipulation library built-in Framework7. It utilizes most edge and high-performance methods for DOM manipulation. You don’t need to learn something new, its usage is very simple because it has the same syntax as well known jQuery library with support of the most popular and widely used methods and jQuery-like chaining.
See Framework7 Dom7 documentation for usage examples and available methods.
Dom7 can be installed with NPM:
npm install dom7 --save
// import Dom7 and methods you need
import { $, addClass, removeClass, toggleClass, on } from 'dom7';
// install methods
$.fn.addClass = addClass;
$.fn.removeClass = removeClass;
$.fn.toggleClass = toggleClass;
$.fn.on = on;
// use
$('p').addClass('custom-paragraph');
$('p').on('click', function() {
$(this).toggleClass('custom-paragraph');
});
Yes please! See the contributing guidelines for details.
This project is licensed under the terms of the MIT license.
4.0.3 (2022-01-11)
new Array(number)
use caseFAQs
Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
The npm package dom7 receives a total of 455,872 weekly downloads. As such, dom7 popularity was classified as popular.
We found that dom7 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.