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
f4ffcdf7
Commit
f4ffcdf7
authored
Apr 22, 2013
by
David Stutz
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #58 from programcsharp/master
Normalize prop access
parents
c7b5fb42
33311d45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
bootstrap-multiselect.js
js/bootstrap-multiselect.js
+31
-31
No files found.
js/bootstrap-multiselect.js
View file @
f4ffcdf7
...
...
@@ -129,8 +129,7 @@
// Will build an dropdown element for the given option.
createOptionValue
:
function
(
element
)
{
if
(
$
(
element
).
is
(
'
:selected
'
))
{
$
(
element
).
attr
(
'
selected
'
,
'
selected
'
);
$
(
element
).
prop
(
'
selected
'
,
'
selected
'
);
$
(
element
).
attr
(
'
selected
'
,
'
selected
'
).
prop
(
'
selected
'
,
true
);
}
// Support the label attribute on options.
...
...
@@ -148,7 +147,7 @@
$
(
'
ul
'
,
this
.
$container
).
append
(
li
);
if
(
$
(
element
).
is
(
'
:disabled
'
))
{
checkbox
.
attr
(
'
disabled
'
,
'
disabled
'
).
prop
(
'
disabled
'
,
'
disabled
'
).
parents
(
'
li
'
).
addClass
(
'
disabled
'
)
checkbox
.
attr
(
'
disabled
'
,
'
disabled
'
).
prop
(
'
disabled
'
,
true
).
parents
(
'
li
'
).
addClass
(
'
disabled
'
);
}
checkbox
.
prop
(
'
checked
'
,
selected
);
...
...
@@ -206,20 +205,22 @@
var
option
=
$
(
'
option
'
,
this
.
$select
).
filter
(
function
()
{
return
$
(
this
).
val
()
==
$
(
event
.
target
).
val
();
});
var
$optionsNotThis
=
$
(
'
option
'
,
this
.
$select
).
not
(
$
(
option
));
var
$checkboxesNotThis
=
$
(
'
input
'
,
this
.
$container
).
not
(
$
(
event
.
target
));
if
(
isSelectAllOption
)
{
$checkboxesNotThis
.
filter
(
function
()
{
return
$
(
this
).
is
(
'
:checked
'
)
!=
checked
;
}).
trigger
(
'
click
'
);
}
if
(
checked
)
{
option
.
attr
(
'
selected
'
,
'
selected
'
);
option
.
prop
(
'
selected
'
,
'
selected
'
);
if
(
!
this
.
options
.
multiple
)
{
option
.
prop
(
'
selected
'
,
true
);
if
(
!
this
.
options
.
multiple
)
{
if
(
this
.
options
.
selectedClass
)
{
$
(
$checkboxesNotThis
).
parents
(
'
li
'
).
removeClass
(
this
.
options
.
selectedClass
);
}
$
(
$checkboxesNotThis
).
prop
(
'
checked
'
,
false
);
$optionsNotThis
.
removeAttr
(
'
selected
'
).
removeProp
(
'
selected
'
);
$optionsNotThis
.
removeAttr
(
'
selected
'
).
prop
(
'
selected
'
,
false
);
// It's a single selection, so close.
$
(
this
.
$container
).
find
(
"
.multiselect.dropdown-toggle
"
).
click
();
...
...
@@ -228,9 +229,10 @@
if
(
this
.
options
.
selectedClass
==
"
active
"
)
{
$optionsNotThis
.
parents
(
"
a
"
).
css
(
"
outline
"
,
""
);
}
}
else
{
option
.
removeAttr
(
'
selected
'
);
option
.
removeAttr
(
'
selected
'
)
.
prop
(
'
selected
'
,
false
)
;
}
var
options
=
this
.
getSelected
();
...
...
@@ -339,8 +341,7 @@
checkbox
.
prop
(
'
checked
'
,
true
);
option
.
attr
(
'
selected
'
,
'
selected
'
);
option
.
prop
(
'
selected
'
,
'
selected
'
);
option
.
attr
(
'
selected
'
,
'
selected
'
).
prop
(
'
selected
'
,
true
);
var
options
=
this
.
getSelected
();
$
(
'
button
'
,
this
.
$container
).
html
(
this
.
options
.
buttonText
(
options
,
this
.
$select
));
...
...
@@ -357,8 +358,7 @@
checkbox
.
prop
(
'
checked
'
,
false
);
option
.
removeAttr
(
'
selected
'
);
option
.
removeProp
(
'
selected
'
);
option
.
removeAttr
(
'
selected
'
).
prop
(
'
selected
'
,
false
);
var
options
=
this
.
getSelected
();
$
(
'
button
'
,
this
.
$container
).
html
(
this
.
options
.
buttonText
(
options
,
this
.
$select
));
...
...
@@ -379,14 +379,14 @@
// For IE 9 support.
getSelected
:
function
()
{
if
(
navigator
.
appName
==
'
Microsoft Internet Explorer
'
)
{
var
regex
=
new
RegExp
(
"
MSIE ([0-9]{1,}[
\
.0-9]{0,})
"
);
if
(
regex
.
exec
(
navigator
.
userAgent
)
!=
null
)
{
return
$
(
'
option:selected[value!="select-all-option"]
'
,
this
.
$select
);
}
}
//
if (navigator.appName == 'Microsoft Internet Explorer') {
//
var regex = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
//
if (regex.exec(navigator.userAgent) != null) {
//
return $('option:selected[value!="select-all-option"]', this.$select);
//
}
//
}
return
$
(
'
option
[selected]
[value!="select-all-option"]
'
,
this
.
$select
);
return
$
(
'
option
:selected
[value!="select-all-option"]
'
,
this
.
$select
);
}
};
...
...
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