Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
607210e0
Commit
607210e0
authored
Mar 10, 2011
by
timmywil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up hasAttr a little
parent
5eecb13f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
attributes.js
src/attributes.js
+13
-11
No files found.
src/attributes.js
View file @
607210e0
...
@@ -334,18 +334,20 @@ jQuery.extend({
...
@@ -334,18 +334,20 @@ jQuery.extend({
},
},
hasAttr
:
function
(
elem
,
name
)
{
hasAttr
:
function
(
elem
,
name
)
{
var
inAttrs
,
attrs
=
elem
.
attributes
;
return
elem
.
hasAttribute
?
if
(
elem
.
hasAttribute
)
{
elem
.
hasAttribute
(
name
)
:
return
elem
.
hasAttribute
(
name
);
(
function
()
{
}
else
{
// Some browsers do not understand the associative indexes
// Browsers do not understand the associative indexes, look for the name in elem.attributes.name
// Look for the name in elem.attributes.name
for
(
var
i
=
0
,
l
=
attrs
.
length
;
i
<
l
;
i
++
)
{
var
attrs
=
elem
.
attributes
,
i
=
0
,
len
=
attrs
.
length
;
if
(
attrs
[
i
][
"name"
]
===
name
)
{
for
(
;
i
<
len
;
i
++
)
{
return
true
;
if
(
attrs
[
i
][
"name"
]
===
name
)
{
return
true
;
}
}
}
}
return
false
;
}
})();
},
},
attrHooks
:
{
attrHooks
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment