mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-26 03:51:57 +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)
|
|
}
|