Have you ever tried to track down which piece of javascript modified the DOM?
Use a mutationObserver to monitor the DOM for changes. Then run console.trace()
inside the callback. This will log a stack trace all the way back to the code that did the DOM modification.
Basically copy and paste this code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LiteralUnion } from 'type-fest'; | |
import { Controller } from '@hotwired/stimulus'; | |
import * as customer from 'application/customer'; | |
export class Sizing extends Controller { | |
/** | |
* Stimulus Values | |
*/ | |
static values = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Streamlined Shopify theme development. | |
NOTE: depends on module gulp-shopify-theme | |
npm install --save-dev yargs gulp gulp-sass gulp-changed gulp-sourcemaps gulp-autoprefixer gulp-uglify gulp-concat gulp-replace gulp-plumber gulp-babel browser-sync gulp-if del gulp-add-src gulp-rename gulp-yaml gulp-shopify-theme | |
Highlights: | |
- https proxying via BrowserSync |
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.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent