4 ms·
That killed my facebook tab
by PSeitz 12y ago
That killed my facebook tab
- runeks 12y agofunction() { Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(element) { element.style.background = 'rgba(255,0,0,0.1)'; }) } is executed every 500 ms using command in question. So if the above function takes 500 ms or more to execute, the tab will get stuck (I would think). Try just executing this command once: Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(element) { element.style.background = 'rgba(255,0,0,0.1)'; })
- PSeitz 12y agoYes, the attribute selector could be slow and/or the non-opaque drawing, I guess.
- PSeitz 12y agoYes, the attribute selector could be slow and/or the non-opaque drawing, I guess.
- dcherman 12y agoInstead of using a timer or a one time selector, just add a new CSS rule via a style tag (function() { var style = document.createElement( "style" ); style.innerHTML = "[data-reactid] { background: rgba(255,0,0,0.1); }"; document.head.appendChild( style ); }());