mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 17:14:58 -05:00
Attributes: Avoid infinite recursion on non-lowercase attribute getters
Attribute hooks are determined for the lowercase versions of attribute names but this has not been reflected in the bool attribute hooks. The code that temporarily removed a handler to avoid an infinite loop was removing an incorrect handler causing stack overflow. Fixes gh-3133 Refs gh-2914 Refs gh-2916 Closes gh-3134
This commit is contained in:
@@ -1642,3 +1642,22 @@ QUnit.test( "SVG class manipulation (gh-2199)", function( assert ) {
|
||||
assert.ok( !elem.hasClass( "awesome" ), "SVG element (" + this + ") toggles the class off" );
|
||||
} );
|
||||
} );
|
||||
|
||||
QUnit.test( "non-lowercase boolean attribute getters should not crash", function( assert ) {
|
||||
assert.expect( 3 );
|
||||
|
||||
var elem = jQuery( "<input checked required autofocus type='checkbox'>" );
|
||||
|
||||
jQuery.each( {
|
||||
checked: "Checked",
|
||||
required: "requiRed",
|
||||
autofocus: "AUTOFOCUS"
|
||||
}, function( lowercased, original ) {
|
||||
try {
|
||||
assert.strictEqual( elem.attr( original ), lowercased,
|
||||
"The '" + this + "' attribute getter should return the lowercased name" );
|
||||
} catch ( e ) {
|
||||
assert.ok( false, "The '" + this + "' attribute getter threw" );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user