aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2015-11-30 11:30:31 -0500
committerTimmy Willison <timmywillisn@gmail.com>2015-12-02 10:39:02 -0500
commitfbf829b7245f7d76ea02a44ab0a62427214b7575 (patch)
tree33b575fd1840f4b34aec0d5ff861d4f61f536cf5 /src
parent6680c1b29ea79bf33ac6bd31578755c7c514ed3e (diff)
downloadjquery-fbf829b7245f7d76ea02a44ab0a62427214b7575.tar.gz
jquery-fbf829b7245f7d76ea02a44ab0a62427214b7575.zip
Attributes: exclusively lowercase A-Z in attribute names
Fixes gh-2730 Close gh-2749
Diffstat (limited to 'src')
-rw-r--r--src/attributes/attr.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/attributes/attr.js b/src/attributes/attr.js
index ae48676d1..00b08489d 100644
--- a/src/attributes/attr.js
+++ b/src/attributes/attr.js
@@ -7,7 +7,14 @@ define( [
], function( jQuery, access, support, rnotwhite ) {
var boolHook,
- attrHandle = jQuery.expr.attrHandle;
+ attrHandle = jQuery.expr.attrHandle,
+
+ // Exclusively lowercase A-Z in attribute names (gh-2730)
+ // https://dom.spec.whatwg.org/#converted-to-ascii-lowercase
+ raz = /[A-Z]+/g,
+ lowercase = function( ch ) {
+ return ch.toLowerCase();
+ };
jQuery.fn.extend( {
attr: function( name, value ) {
@@ -39,7 +46,7 @@ jQuery.extend( {
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
- name = name.toLowerCase();
+ name = name.replace( raz, lowercase );
hooks = jQuery.attrHooks[ name ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
}