Skip to content

Commit

Permalink
Update index.html [q]
Browse files Browse the repository at this point in the history
  • Loading branch information
stopsopa authored Dec 13, 2024
1 parent 0a5a99d commit 7aecd9c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pages/js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,32 @@ <h2>get local time DATE</h2>
return newDate.toISOString().substring(0, 19).replace("T", " ");
}
</script>
<h2>visible isVisible</h2>
<script type="editor" data-lang="js">

const isVisibleElement = (function () {
const list = ["script", "style", "meta", "noscript", "template", "link"];

return function tool(element) {
const tagName = element.tagName.toLowerCase();

if (list.includes(tagName)) {
return tool(element.parentNode);
}

if (tagName === "input" && element.type === "hidden") {
return tool(element.parentNode);
}

return element.checkVisibility();
};
})();

function filterVisibleList(list) {
return list.filter(isVisibleElement);
}

</script>
<h2>focus blur</h2>
<script type="editor" data-lang="js">

Expand Down

0 comments on commit 7aecd9c

Please sign in to comment.