mirror of
https://github.com/MontFerret/ferret.git
synced 2025-02-03 13:11:45 +02:00
29 lines
382 B
Go
29 lines
382 B
Go
|
package templates
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/MontFerret/ferret/pkg/drivers"
|
||
|
)
|
||
|
|
||
|
func Blur() string {
|
||
|
return `
|
||
|
(el) => {
|
||
|
el.blur()
|
||
|
}
|
||
|
`
|
||
|
}
|
||
|
|
||
|
func BlurBySelector(selector string) string {
|
||
|
return fmt.Sprintf(`
|
||
|
(parent) => {
|
||
|
const el = parent.querySelector('%s');
|
||
|
|
||
|
if (el == null) {
|
||
|
throw new Error('%s')
|
||
|
}
|
||
|
|
||
|
el.blur();
|
||
|
}
|
||
|
`, selector, drivers.ErrNotFound)
|
||
|
}
|