Source File
html.go
Belonging Package
github.com/pancsta/go-app/pkg/app
package app// HTML provides an interface for representing HTML elements within the// application.type HTML interface {UI// Tag retrieves the name of the HTML tag that the element represents.Tag() string// XMLNamespace fetches the XML namespace associated with the HTML element.// This is relevant for elements like SVG which might have a different// namespace.XMLNamespace() string// SelfClosing determines whether the HTML element is self-closing.// For elements like <img> or <br> which don't have closing tags, this// method returns true. Otherwise, it returns false.SelfClosing() booldepth() uintattrs() attributessetAttrs(attributes) HTML// SetAttr sets an HTML attribute.SetAttr(name string, value any)events() eventHandlerssetEvents(eventHandlers) HTMLsetDepth(uint) UIsetJSElement(Value) HTMLparent() UIbody() []UIsetBody([]UI) HTML}type htmlElement struct {tag stringxmlns stringtreeDepth uintisSelfClosing booljsElement Valueattributes attributeseventHandlers eventHandlersparentElement UIchildren []UI}func ( *htmlElement) () Value {return .jsElement}func ( *htmlElement) () bool {return .jsElement != nil}func ( *htmlElement) () string {return .tag}func ( *htmlElement) () string {return .xmlns}func ( *htmlElement) () bool {return .isSelfClosing}func ( *htmlElement) () uint {return .treeDepth}func ( *htmlElement) () attributes {return .attributes}func ( *htmlElement) ( string, any) {if .attributes == nil {.attributes = make(attributes)}.attributes.Set(, )}// SetAttr sets an HTML attribute.func ( *htmlElement) ( string, any) {.setAttr(, )}func ( *htmlElement) () eventHandlers {return .eventHandlers}func ( *htmlElement) ( string, EventHandler, ...EventOption) {if .eventHandlers == nil {.eventHandlers = make(eventHandlers)}.eventHandlers.Set(, , ...)}func ( *htmlElement) () UI {return .parentElement}func ( *htmlElement) () []UI {return .children}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |