-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
75 lines (75 loc) · 2.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0" />
<title>Shadow DOM Bookmarklet</title>
<meta
name="description"
content="A bookmarklet to check for Shadow DOM elements on a page." />
<style>
body {
font-family: sans-serif;
margin: 2rem;
}
a.bookmarklet {
display: block;
padding: 10px 20px;
border: 1px solid #ccc;
border-radius: 5px;
color: #333;
width: 15rem;
background: blue;
color: white;
}
textarea {
padding: 1rem;
}
</style>
</head>
<body>
<h1>Shadow DOM</h1>
<p>Drag this link to the Bookmarks Bar of your browser.</p>
<p>
<a
class="bookmarklet"
href="javascript:(function(){let e=document.querySelectorAll('*'),t=0;e.forEach(e=>{e.shadowRoot&&t++}),alert('This page contains '+t+' Shadow DOM elements.')})()"
>Check for Shadow DOM element</a
>
</p>
<p>
If you can't drag the link,
<a
href=""
id="copyLink"
>copy the code below (or click this link)</a
>
and bookmark it in the traditional way.
</p>
<p>
<textarea
id="bookmarkletCode"
cols="80"
rows="2">
javascript:(function(){let e=document.querySelectorAll('*'),t=0;e.forEach(e=>{e.shadowRoot&&t++}),alert('This page contains '+t+' Shadow DOM elements.')})()</textarea
>
</p>
<p>You'll see an alert like this:</p>
<p>
<img
src="example.png"
srcset="example.png 2x"
alt="Alert says: 'www.vdab.be says This pagecontains 110 Shadow DOM elements.'" />
</p>
<p>
See this
<a
href="https://elevenways.slack.com/archives/C03R2AYNYRG/p1701464754915289"
>Slack discussion about Shadow DOM</a
>.
</p>
<script src="script.js"></script>
</body>
</html>