-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreference.go
More file actions
41 lines (28 loc) · 1.06 KB
/
Copy pathreference.go
File metadata and controls
41 lines (28 loc) · 1.06 KB
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
package dom
// Reference represents a reference to a DOM node. It provides methods for reading and interaction.
type Reference interface {
// --- Attributes ---
// GetAttr retrieves an attribute value.
GetAttr(key string) string
// --- Forms ---
// Value returns the current value of an input/textarea/select.
Value() string
// SetValue sets element.value (inputs, textarea, select).
SetValue(value string)
// SetAttr calls element.setAttribute(key, value).
// Use empty string for boolean attributes (e.g., SetAttr("disabled", "")).
SetAttr(key, value string)
// RemoveAttr calls element.removeAttribute(key).
RemoveAttr(key string)
// SetText sets element.textContent.
// Safe for plain text — does not parse HTML.
SetText(text string)
// --- Checkboxes ---
// Checked returns the current checked state of a checkbox or radio button.
Checked() bool
// --- Events ---
// On registers a generic event handler (e.g., "click", "change", "input", "keydown").
On(eventType string, handler func(event Event))
// Focus sets focus to the element.
Focus()
}