Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jhonalino's full-sized avatar
🤷‍♂️
just writing javascript

Jhon (kiko) jhonalino

🤷‍♂️
just writing javascript
View GitHub Profile
@jhonalino
jhonalino / what-forces-layout.md
Created June 17, 2022 09:31 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFbcTbSIYZ30FJCw3eXOYFKB9XDy1l9Hv2ETxE7xn+8IHiflLm3DYb0mF0Shhaouj3E6QXIduh9IDhUjt75L1KOp+YF73WMmylm1IBu2ZL+9e76TrUVlZNEqDlCvjugntiyxtUqYpAyPWXVpaRLxsyy07XV6uvjyLEO8EhOb0gCiIoodmmwP5neHslcntFvUGsb0vYNO56kBwFBrEv7x+rRRaV6tRsGSyITkALb55BbwaLWPsyUoa11hU48GGT56ZkKBETxfi5pFY2WUlLoHt+qyty+Bfh+1EVi+y+gIA/rqYhyIJZkyiaJPGHpk+TkYS9sFAsxMRWH6nC9p/JxNYmDOGoapH9hV3tn2JvUwXsORREpfvxYhY1w2CMSUw4/YuAgzZVX7XhcijK68vKwH5RtA3ued75IfBurzxNCh/+WavYFbi0t33qSE3xYgU9QGEjIm5gDFf7PwLZI0Gf4ArKijzWqf6o3mhSGrFa6yPX45MdOQ58QNON5bW4nsbXLLc= jhon@jhon-lenovo
@jhonalino
jhonalino / css_reset
Created September 3, 2018 00:02
eric meyer css reset
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@jhonalino
jhonalino / .block
Last active June 18, 2018 04:49
fresh block
license: mit
var val = undefined
if(val === undefined || val === null) {
//do something
}
if(val == undefined) {
//do something
}
if(num === 10 || num === "10") {
//do someting
}
if(num == 10) {
//do someting
}
function doImportantStuff() {
//function scope
var someVariable = "important stuff";
}
{
//block scope
let anotherVariable = "not so important";
}
function doImportantStuff() {
var someVariable = "important stuff";
console.log(someVariable); // "important stuff"
console.log(anotherVariable); // oops can't access that
}
function anotherImportantStuff() {
var anotherVariable = "not so important";
}
function doImportantStuff() {
var someVariable = "important stuff";
function reportImportantStuff() {
console.log(someVariable) // "important stuff"
}
reportImportantStuff();
}
@jhonalino
jhonalino / README.md
Created May 2, 2018 23:13 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})