Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb40a480

Browse files
authored
Attributes: Shave off a couple of bytes
The `attrHooks` entries for boolean attributes are only defined for jQuery 4+;jQuery 3.x used a separate mechanism - assigning them to`jQuery.expr.attrHandle`. That object used to be maintained by Sizzle, sincejQuery 3.7.0 it's kept in the selector module. Because of that, the `isXMLDoc`check used to be require in this hook.Now that standard `attrHooks` are used, the `isXMLDoc` check already happensinside of `jQuery.attr` and there's no need to repeat it in the test. Note thatthis repetition is even incorrect - while Sizzle's `jQuery.find.attr` used totreat an `undefined` output of the hooks from `jQuery.expr.attrHandle` as a wayto opt out of the hook, jQuery's `attrHooks` use `null` to opt out of a getterhook.Apart from the size, this patch also avoids unnecessary extra checks.Closesgh-5398
1 parent805cdb4 commitb40a480

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

‎src/attributes/attr.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,9 @@ jQuery.each( (
108108
).split(" "),function(_i,name){
109109
jQuery.attrHooks[name]={
110110
get:function(elem){
111-
varret,
112-
isXML=jQuery.isXMLDoc(elem),
113-
lowercaseName=name.toLowerCase();
114-
115-
if(!isXML){
116-
ret=elem.getAttribute(name)!=null ?
117-
lowercaseName :
118-
null;
119-
}
120-
returnret;
111+
returnelem.getAttribute(name)!=null ?
112+
name.toLowerCase() :
113+
null;
121114
},
122115

123116
set:function(elem,value,name){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp