Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bootstrap-multiselect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
bootstrap-multiselect
Commits
47d60e38
Commit
47d60e38
authored
Mar 31, 2014
by
David Stutz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #274 from yuripc/patch-2
Remove multiple $(event.target) object creation.
parents
382e0976
b45532b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+16
-12
No files found.
js/bootstrap-multiselect.js
View file @
47d60e38
...
...
@@ -320,27 +320,29 @@
// Bind the change event on the dropdown elements.
$
(
'
li input
'
,
this
.
$ul
).
on
(
'
change
'
,
$
.
proxy
(
function
(
event
)
{
var
checked
=
$
(
event
.
target
).
prop
(
'
checked
'
)
||
false
;
var
isSelectAllOption
=
$
(
event
.
target
).
val
()
===
this
.
options
.
selectAllValue
;
var
$target
=
$
(
event
.
target
);
var
checked
=
$target
.
prop
(
'
checked
'
)
||
false
;
var
isSelectAllOption
=
$target
.
val
()
===
this
.
options
.
selectAllValue
;
// Apply or unapply the configured selected class.
if
(
this
.
options
.
selectedClass
)
{
if
(
checked
)
{
$
(
event
.
target
)
.
parents
(
'
li
'
)
$
target
.
parents
(
'
li
'
)
.
addClass
(
this
.
options
.
selectedClass
);
}
else
{
$
(
event
.
target
)
.
parents
(
'
li
'
)
$
target
.
parents
(
'
li
'
)
.
removeClass
(
this
.
options
.
selectedClass
);
}
}
// Get the corresponding option.
var
value
=
$
(
event
.
target
)
.
val
();
var
value
=
$
target
.
val
();
var
$option
=
this
.
getOptionByValue
(
value
);
var
$optionsNotThis
=
$
(
'
option
'
,
this
.
$select
).
not
(
$option
);
var
$checkboxesNotThis
=
$
(
'
input
'
,
this
.
$container
).
not
(
$
(
event
.
target
)
);
var
$checkboxesNotThis
=
$
(
'
input
'
,
this
.
$container
).
not
(
$
target
);
if
(
isSelectAllOption
)
{
if
(
this
.
$select
[
0
][
0
].
value
===
this
.
options
.
selectAllValue
)
{
...
...
@@ -408,19 +410,21 @@
$
(
'
li a
'
,
this
.
$ul
).
on
(
'
touchstart click
'
,
function
(
event
)
{
event
.
stopPropagation
();
var
$target
=
$
(
event
.
target
);
if
(
event
.
shiftKey
)
{
var
checked
=
$
(
event
.
target
)
.
prop
(
'
checked
'
)
||
false
;
var
checked
=
$
target
.
prop
(
'
checked
'
)
||
false
;
if
(
checked
)
{
var
prev
=
$
(
event
.
target
)
.
parents
(
'
li:last
'
)
var
prev
=
$
target
.
parents
(
'
li:last
'
)
.
siblings
(
'
li[class="active"]:first
'
);
var
currentIdx
=
$
(
event
.
target
)
.
parents
(
'
li
'
)
var
currentIdx
=
$
target
.
parents
(
'
li
'
)
.
index
();
var
prevIdx
=
prev
.
index
();
if
(
currentIdx
>
prevIdx
)
{
$
(
event
.
target
)
.
parents
(
"
li:last
"
).
prevUntil
(
prev
).
each
(
$
target
.
parents
(
"
li:last
"
).
prevUntil
(
prev
).
each
(
function
()
{
$
(
this
).
find
(
"
input:first
"
).
prop
(
"
checked
"
,
true
)
.
trigger
(
"
change
"
);
...
...
@@ -428,7 +432,7 @@
);
}
else
{
$
(
event
.
target
)
.
parents
(
"
li:last
"
).
nextUntil
(
prev
).
each
(
$
target
.
parents
(
"
li:last
"
).
nextUntil
(
prev
).
each
(
function
()
{
$
(
this
).
find
(
"
input:first
"
).
prop
(
"
checked
"
,
true
)
.
trigger
(
"
change
"
);
...
...
@@ -438,7 +442,7 @@
}
}
$
(
event
.
target
)
.
blur
();
$
target
.
blur
();
});
// Keyboard support.
...
...
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