JSFiddle - React, Tailwind, and code Playground
JavaScript
Object.getOwnPropertyNames(this).filter(function (e) {
try {
return (this[e] && this[e].prototype && this[e].prototype.item);
} catch (f) {
console.log(f);
}
}).forEach(function (w) {
Object.getOwnPropertyNames(Array.prototype).forEach(function (e) {
if (e!=='length') {
this[w].prototype[e] = function () {
var args = [].map.call(arguments, function (h) {
if (h && h.item) return [].slice.call(h);
return h;
});
return Array.prototype[e].apply(this, args);
};
}
});
this[w].prototype._length = 0;
Object.defineProperty(this[w].prototype, "size", {
get: function () {
return this._length;
},
set: function (e) {
console.log('test');
this._length = e;
}
});
});
var a = document.getElementsByTagName('div');
console.dir(a);
//a.addEventListener('length', function (e) {
// console.log(e);
//}, false);
document.body.appendChild(document.createTextNode(a.length));
var div = document.createElement('div');
div.textContent = a.length;
document.body.appendChild(div);
document.body.appendChild(document.createTextNode(a.length));
a.forEach(function (e) {
document.body.appendChild(e.cloneNode(true));
});
document.body.appendChild(document.createTextNode(a.length));
a.size = 10;
a.forEach(function (e, i) {
e.textContent = i;
});
document.body.appendChild(document.createTextNode(a.length));
a.forEach(function (e) {
document.body.appendChild(e.cloneNode(true));
});