File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -3271,14 +3271,14 @@ var htmx = (function() {
32713271 function removeRequestIndicators ( indicators , disabled ) {
32723272 forEach ( indicators , function ( ic ) {
32733273 const internalData = getInternalData ( ic )
3274- internalData . requestCount = ( internalData . requestCount || 0 ) - 1
3274+ internalData . requestCount = ( internalData . requestCount || 1 ) - 1
32753275 if ( internalData . requestCount === 0 ) {
32763276 ic . classList . remove . call ( ic . classList , htmx . config . requestClass )
32773277 }
32783278 } )
32793279 forEach ( disabled , function ( disabledElement ) {
32803280 const internalData = getInternalData ( disabledElement )
3281- internalData . requestCount = ( internalData . requestCount || 0 ) - 1
3281+ internalData . requestCount = ( internalData . requestCount || 1 ) - 1
32823282 if ( internalData . requestCount === 0 ) {
32833283 disabledElement . removeAttribute ( 'disabled' )
32843284 disabledElement . removeAttribute ( 'data-disabled-by-htmx' )
Original file line number Diff line number Diff line change @@ -80,4 +80,16 @@ describe('hx-disabled-elt attribute', function() {
8080 b2 . hasAttribute ( 'disabled' ) . should . equal ( false )
8181 b3 . hasAttribute ( 'disabled' ) . should . equal ( false )
8282 } )
83+
84+ it ( 'load trigger does not prevent disabled element working' , function ( ) {
85+ this . server . respondWith ( 'GET' , '/test' , 'Loaded!' )
86+ var div1 = make ( '<div id="d1" hx-get="/test" hx-disabled-elt="#b1" hx-trigger="load">Load Me!</div><button id="b1">Demo</button>' )
87+ var div = byId ( 'd1' )
88+ var btn = byId ( 'b1' )
89+ div . innerHTML . should . equal ( 'Load Me!' )
90+ btn . hasAttribute ( 'disabled' ) . should . equal ( true )
91+ this . server . respond ( )
92+ div . innerHTML . should . equal ( 'Loaded!' )
93+ btn . hasAttribute ( 'disabled' ) . should . equal ( false )
94+ } )
8395} )
You can’t perform that action at this time.
0 commit comments