Releases: maddalax/htmgo
Releases · maddalax/htmgo
v0.3.5
- Updated OnLoad event handler to always be called on any element (not just browser supported ones such as Script, Body, Img, etc)
This means if you need run a command / eval js against a specific element when it loads in (on initial load or even after swap), you can do so.
Example:
h.Div(
h.OnLoad(
js.EvalJs(`self.focus()`)
)
)
You can reference the current element using 'self' or 'element' if you are evaluating JS on a parent or sibling.
- Removed usage of html.EscapeString on GetPartialPathWithQs
v0.3.4
What's Changed
- Update watcher to include newly added directories
- Fix GetPartialPath 404ing if calling it from a nested route (#17) thanks @Pitasi
- Add a few utility methods to h.RequestContext
func (c *RequestContext) FormValue(key string)
func (c *RequestContext) Header(key string)
func (c *RequestContext) UrlParam(key string)
func (c *RequestContext) QueryParam(key string)
func (c *RequestContext) IsBoosted() bool
func (c *RequestContext) IsHxRequest() bool
func (c *RequestContext) HxPromptResponse()
func (c *RequestContext) HxTargetId()
func (c *RequestContext) HxTriggerName()
func (c *RequestContext) HxTriggerId()
func (c *RequestContext) HxCurrentBrowserUrl()
Also added
func GetRequestContext(r *http.Request) *RequestContext {
return r.Context().Value(RequestContextKey).(*RequestContext)
}
Usage:
app.Router.Get("/test", func(writer http.ResponseWriter, request *http.Request) {
ctx := h.GetRequestContext(request)
})
For if you need to get the h.RequestContext from an http.Request. This is useful if you are doing your own routing but still want to use h.RequestContext to pass to other things such as partials or other pages.
Full Changelog: v0.3.3...v0.3.4
v0.3.3
v0.3.2
v0.3.1
- Added multiple new JS commands
- SetTextOnChildren
- SetClassOnChildren
- RemoveClassOnChildren
- SetClassOnSibling
- RemoveClassOnSibling
- SubmitFormOnEnter
-
Added more common attributes
-
Adding html escaping when rendering using Text()
-
Renamed Raw to UnsafeRaw to signify it does not do html escaping
v0.3.0
What's Changed
- swap out echo with std lib + chi router
- multiple new tags added
- caching utilities added to the framework, see https://htmgo.dev/docs#performance-caching-globally