Pinterest: outline data-test-id elements
Draws outlines around elements with a data-test-id attribute and shows their values to help write your own rules.
Code to copy
// Outline every element carrying a data-test-id and show its value
const STYLE_ID = 'jz-pin-outline-style';
if (!document.getElementById(STYLE_ID)) {
const s = document.createElement('style');
s.id = STYLE_ID;
s.textContent =
'[data-test-id]{outline:1px solid rgba(230,0,35,0.6)!important;position:relative!important}' +
'[data-test-id]::after{content:attr(data-test-id);position:absolute;top:0;left:0;' +
'background:#e60023;color:#fff;font:10px monospace;padding:1px 3px;z-index:99999}';
document.head.appendChild(s);
}
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.