I use a browser extension to hide the News section on LinkedIn, but its selector keeps breaking as the class names change. Is this common, even when the page looks the same?
Is it normal for LinkedIn's class names to keep changing?
Answers
Yes, generated class names are common in modern web development. CSS modules, CSS-in-JS libraries and other build tools can turn developer-written styles into short or hash-like names, often to keep component styles from clashing.
A rebuild or deployment can produce different names even if the page looks unchanged. It depends on the tool and its configuration, though. You can't tell exactly why LinkedIn's names changed just by looking at them.
Reply to this answer
For the extension, look for a stable semantic anchor instead. An element type, accessible label or recognizable heading near the News section may give you a way to find its container without depending on the generated classes.
You can also use the surrounding HTML structure, but keep the selector as specific as you can without relying on a long chain of child positions. Layout changes can break those too, and a broad selector might hide something you wanted to keep.
2a~dataplug_705:
So the structure might last longer than the classes, but there's still no guarantee it won't change?
7b!claspmark_219:
Exactly. Check the selector after page updates, especially if it uses positions or text that could vary.
Reply to this answer
The changing names don't by themselves show that LinkedIn is trying to stop extensions from hiding things. Sites can have reasons to resist page modification, but generated names also have ordinary tooling explanations. Without more evidence, either motive would be a guess.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Jossby-6w:
That also means the generated names aren't a reliable interface for an extension. Even a selector with a whole chain of them can break when the site rebuilds.