aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-12-09 21:28:33 -0800
committerJohn Resig <jeresig@gmail.com>2009-12-09 21:28:33 -0800
commitf25eedf32a7555f71a246c6f491292ce876c4133 (patch)
tree93e5020b9a640b2ae69b7c3b3a6c237fe75aa165 /src/attributes.js
parent1a4d1904ae8631f94b7400d99af24d3fe2f33ecd (diff)
downloadjquery-f25eedf32a7555f71a246c6f491292ce876c4133.tar.gz
jquery-f25eedf32a7555f71a246c6f491292ce876c4133.zip
Restrict the attr quick setters to only methods that specifically ask for the functionality. Fixes #5612.
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/attributes.js b/src/attributes.js
index 8080af83d..fb5b16bcd 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -200,12 +200,27 @@ jQuery.each({
});
jQuery.extend({
+ attrFn: {
+ val: true,
+ addClass: true,
+ css: true,
+ html: true,
+ text: true,
+ append: true,
+ prepend: true,
+ data: true,
+ width: true,
+ height: true,
+ offset: true
+ },
+
attr: function( elem, name, value ) {
// don't set attributes on text and comment nodes
if (!elem || elem.nodeType == 3 || elem.nodeType == 8) {
return undefined;
}
- if ( name in jQuery.fn && name !== "attr" ) {
+
+ if ( name in jQuery.attrFn ) {
return jQuery(elem)[name](value);
}