traw 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -74,8 +74,6 @@ export class BrowserController {
|
|
|
74
74
|
|
|
75
75
|
const walk = (node: Element, depth: number) => {
|
|
76
76
|
const el = node as HTMLElement
|
|
77
|
-
if (el.offsetParent === null && el.tagName !== "BODY" && el.tagName !== "HTML") return
|
|
78
|
-
|
|
79
77
|
const tag = el.tagName.toLowerCase()
|
|
80
78
|
const indent = " ".repeat(depth)
|
|
81
79
|
|
|
@@ -99,7 +97,7 @@ export class BrowserController {
|
|
|
99
97
|
if (href && tag === "a") attrs.push(`href="${esc(href.slice(0, 80))}"`)
|
|
100
98
|
|
|
101
99
|
const val = (el as HTMLInputElement).value
|
|
102
|
-
if (val) attrs.push(`value="${esc(val
|
|
100
|
+
if (val) attrs.push(`value="${esc(val)}"`)
|
|
103
101
|
|
|
104
102
|
if ((el as any).disabled) attrs.push(`disabled="true"`)
|
|
105
103
|
if ((el as any).checked) attrs.push(`checked="true"`)
|
|
@@ -108,7 +106,7 @@ export class BrowserController {
|
|
|
108
106
|
if (el.getAttribute("aria-expanded")) attrs.push(`expanded="${el.getAttribute("aria-expanded")}"`)
|
|
109
107
|
if (el.getAttribute("aria-selected") === "true") attrs.push(`selected="true"`)
|
|
110
108
|
|
|
111
|
-
const text = el.textContent?.trim()
|
|
109
|
+
const text = el.textContent?.trim() || ""
|
|
112
110
|
const ariaLabel = el.getAttribute("aria-label")
|
|
113
111
|
const placeholder = (el as HTMLInputElement).placeholder
|
|
114
112
|
const label = esc(ariaLabel || text || placeholder || "")
|
|
@@ -123,7 +121,6 @@ export class BrowserController {
|
|
|
123
121
|
.map(n => n.textContent?.trim())
|
|
124
122
|
.join(" ")
|
|
125
123
|
.trim()
|
|
126
|
-
.slice(0, 120)
|
|
127
124
|
|
|
128
125
|
if (directText.length > 2) {
|
|
129
126
|
out.push(`${indent}<${tag}>${esc(directText)}</${tag}>`)
|