@@ -233,6 +233,12 @@ var htmx = (function() {
233233 * @default ['get', 'delete']
234234 */
235235 methodsThatUseUrlParams : [ 'get' , 'delete' ] ,
236+ /**
237+ * Custom HTTP verbs allowed to be parsed as attribute in form hx-custom-verb-XXX or data-hx-custom-verb-XXX where XXX is the custom verb
238+ * @type {(String)[] }
239+ * @default []
240+ */
241+ customVerbs : [ ] ,
236242 /**
237243 * If set to true, disables htmx-based requests to non-origin hosts.
238244 * @type boolean
@@ -354,7 +360,11 @@ var htmx = (function() {
354360 const VERBS = [ 'get' , 'post' , 'put' , 'delete' , 'patch' ]
355361 const VERB_SELECTOR = VERBS . map ( function ( verb ) {
356362 return '[hx-' + verb + '], [data-hx-' + verb + ']'
357- } ) . join ( ', ' )
363+ } ) . concat (
364+ htmx . config . customVerbs . map ( function ( verb ) {
365+ return '[hx-custom-verb-' + verb + '], [data-hx-custom-verb-' + verb + ']'
366+ } )
367+ ) . join ( ', ' )
358368
359369 //= ===================================================================
360370 // Utilities
@@ -2669,9 +2679,11 @@ var htmx = (function() {
26692679 */
26702680 function processVerbs ( elt , nodeData , triggerSpecs ) {
26712681 let explicitAction = false
2672- forEach ( VERBS , function ( verb ) {
2673- if ( hasAttribute ( elt , 'hx-' + verb ) ) {
2674- const path = getAttributeValue ( elt , 'hx-' + verb )
2682+ const verbsWithAssociatedAttributes = VERBS . map ( function ( verb ) { return [ verb , 'hx-' + verb ] } )
2683+ const customVerbsWithAssociatedAttributes = htmx . config . customVerbs . map ( function ( verb ) { return [ verb , 'hx-custom-verb-' + verb ] } )
2684+ forEach ( verbsWithAssociatedAttributes . concat ( customVerbsWithAssociatedAttributes ) , function ( [ verb , attribute ] ) {
2685+ if ( hasAttribute ( elt , attribute ) ) {
2686+ const path = getAttributeValue ( elt , attribute )
26752687 explicitAction = true
26762688 nodeData . path = path
26772689 nodeData . verb = verb
0 commit comments