Set a default type="button" for JS buttons

> The `button` [type] has no default behavior, and does nothing when pressed by default. It can have client-side scripts listen to the element's events, which are triggered when the events occur. — https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
This commit is contained in:
David Larlet 2023-09-01 14:35:38 -04:00
parent 688ef19c04
commit a28d427ba1
No known key found for this signature in database
GPG key ID: 3E2953A359E7E7BD

View file

@ -318,6 +318,7 @@ L.DomUtil.createButton = (className, container, content, callback, context) => {
const el = L.DomUtil.add('a', className, container, content) const el = L.DomUtil.add('a', className, container, content)
el.href = '#' el.href = '#'
// const el = L.DomUtil.add('button', className, container, content) // const el = L.DomUtil.add('button', className, container, content)
// el.type = 'button'
if (callback) { if (callback) {
L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback, context) L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback, context)
} }