Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 94x 94x 81x 222x 94x 222x 94x 98x 94x 120x 94x | /** * @module Utils */ import * as MH from "@lisn/globals/minification-helpers"; import { DOMElement } from "@lisn/globals/types"; /** * Returns all the child elements of the given element that are not `script` or * `style` tags. * * @category DOM: Querying */ export const getVisibleContentChildren = (element: Element) => MH.filter([...MH.childrenOf(element)], (ch) => isVisibleContentTag(MH.tagName(ch)), ); /** * Returns whether the given tag is _not_ `script` or `style`. Comparison is * case insensitive. * * @category DOM: Querying */ export const isVisibleContentTag = (tagName: string) => !MH.includes(["script", "style"], MH.toLowerCase(tagName)); /** * Returns whether the given tag name has by default an inline display. * Comparison is case insensitive. * * @category DOM: Querying */ export const isInlineTag = (tagName: string) => inlineTags.has(tagName.toLowerCase()); /** * Returns whether the given element is as {@link DOMElement}. * * @category DOM: Querying */ export const isDOMElement = (target: unknown): target is DOMElement => MH.isHTMLElement(target) || MH.isInstanceOf(target, SVGElement) || (typeof MathMLElement !== "undefined" && MH.isInstanceOf(target, MathMLElement)); // -------------------- const inlineTags = MH.newSet([ "a", "abbr", "acronym", "b", "bdi", "bdo", "big", "button", "cite", "code", "data", "dfn", "em", "i", "img", "input", "kbd", "label", "mark", "map", "object", "output", "q", "rp", "rt", "ruby", "s", "samp", "script", "select", "small", "span", "strong", "sub", "sup", "textarea", "time", "tt", "u", "var", ]); |