<button>привет</button>
const button = document.querySelector('click', (event) => {
event.preventDefault();
button.textContent = 'пока';
}, { once: true });
main.js
, т. к. gsap
и ScrollTrigger
Вы подключили в него. const links = [...document.querySelectorAll('#filter_frm table')].reduce((acc, table) => {
table.querySelectorAll('tr > td:last-child > a').forEach((link) => {
if (link.textContent.includes('300 бр.')) { // /300\s+бр\./i.test(link.textContent)
acc.push(link.href);
}
});
return acc;
}, []);
console.log(links);
fetch('https://www.kartoteka.ru/')
.then((response) => response.arrayBuffer())
.then((buffer) => {
let html = new TextDecoder('windows-1251').decode(buffer);
let doc = new DOMParser().parseFromString(html, 'text/html');
let b = doc.querySelectorAll(".news_item .image_block_no_image p")[0].innerHTML;
console.log(b);
});
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
const lineWidth = 60;
const radius = 200;
[canvas.width, canvas.height] = [radius * 2, radius * 2];
context.beginPath();
context.arc(radius, radius, radius - lineWidth / 2, 0, Math.PI * 2);
context.closePath();
context.lineWidth = lineWidth;
context.stroke();
document.body.append(canvas);
counter.js
. Хотите каждый раз новый контекст - делайте мини-фабрику (функцию высшего порядка):function createCounter() {
let counter = 0;
function increment() {
counter++;
console.log(counter);
}
function decrement() {
counter--;
console.log(counter);
}
return {
get value() {
return counter;
},
increment,
decrement
};
}
class App {
constructor() {
this.counter = createCounter();
this.subCounter = createCounter();
}
increment() {
this.counter.increment();
}
subIncrement() {
this.subCounter.increment();
}
}
Cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners. It does not copy event listeners added using addEventListener() or those assigned to element properties (e.g., node.onclick = someFunction). Additionally, for a element, the painted image is not copied.
node-sass
и ставим sass
вместо него.node-sass
:choco install visualstudio2017-workload-vctools -y
npm config set msvs_version 2017
choco install visualstudio2019-workload-vctools -y
npm config set msvs_version 2019
(() => {
const gif = 'https://c.tenor.com/dIJjH_qEMpUAAAAC/sully-shock-monsters.gif';
const width = 3;
const space = ' '.repeat(width);
console.log(`%c${space}`, `font-size: 158px; background-image: url(${gif}); background-position: center; background-repeat: no-repeat;`);
})();