const str = '<div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div>';
const result = str.split('</div>').reduce((prev, curr, index, arr) => {
if (index !== arr.length - 1) prev[index] = curr + '</div>';
return prev;
}, []);
// ["<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>", "<div class="abc"></div>"]
var str = '<div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div><div class="abc"></div>';
var regexp = /(<div class="abc"><\/div>)/g;
var matches_array = str.match(regexp);
const div = document.createElement('div');
div.innerHTML = str;
const arr = Array.prototype.map.call(div.children, n => n.outerHTML);
const arr = Array.from(
new DOMParser().parseFromString(str, 'text/html').body.children,
n => n.outerHTML
);
const arr = [];
for (const n of document.createRange().createContextualFragment(str).children) {
arr.push(n.outerHTML);
}
const str = "<div class='abc'></div><div class='abc'></div>";
const array = $(str);
array.each((_, el) => console.log(el));
// результат
// <div class="abc"></div>
// <div class="abc"></div>
.block {
color: #fff;
@media (max-width: 600px) {
color: #369;
}
}
.class {
color: red;
@media (min-width: 600px) {
color: green;
}
}