Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 584ba75

Browse files
committedFeb 9, 2013
Re: #90, #68 - Altered attribute copying logic
1 parent 1a11eb0 commit 584ba75

5 files changed

+13
-31
lines changed
 

‎demos/default.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<option value="">Select a Month</option>
1919
<option value="January" disabled>January</option>
2020
<option value="February">February</option>
21-
<option value="March">March</option>
21+
<option value="March" data-really="yeaaa" title="yea">March</option>
2222
<option value="April">April</option>
2323
<option value="May">May</option>
2424
<option value="June">June</option>

‎src/javascripts/jquery.selectBoxIt.core.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -1731,19 +1731,10 @@
17311731
_addAttributes: function(arr, elem) {
17321732

17331733
var self = this,
1734-
blacklist = [
1734+
// Attributes that will be copied over to the new drop down
1735+
whitelist = [
17351736

1736-
"null",
1737-
1738-
"value",
1739-
1740-
"disabled",
1741-
1742-
"id",
1743-
1744-
"class",
1745-
1746-
"unselectable"
1737+
"title"
17471738

17481739
];
17491740

@@ -1756,8 +1747,8 @@
17561747
// Get's the property name and property value of each property
17571748
var propName = (property.name).toLowerCase(), propValue = property.value;
17581749

1759-
// If the currently traversed property is not on the blacklist and the value is not "null"
1760-
if(propValue !== "null" && $.inArray(propName, blacklist) === -1) {
1750+
// If the currently traversed property value is not "null", is on the whitelist, or is an HTML 5 data attribute
1751+
if(propValue !== "null" && ($.inArray(propName, whitelist) !== -1 || propName.indexOf("data-") !== -1)) {
17611752

17621753
// Set's the currently traversed property on element
17631754
elem.attr(propName, propValue);

‎src/javascripts/jquery.selectBoxIt.core.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/javascripts/jquery.selectBoxIt.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -1731,19 +1731,10 @@
17311731
_addAttributes: function(arr, elem) {
17321732

17331733
var self = this,
1734-
blacklist = [
1734+
// Attributes that will be copied over to the new drop down
1735+
whitelist = [
17351736

1736-
"null",
1737-
1738-
"value",
1739-
1740-
"disabled",
1741-
1742-
"id",
1743-
1744-
"class",
1745-
1746-
"unselectable"
1737+
"title"
17471738

17481739
];
17491740

@@ -1756,8 +1747,8 @@
17561747
// Get's the property name and property value of each property
17571748
var propName = (property.name).toLowerCase(), propValue = property.value;
17581749

1759-
// If the currently traversed property is not on the blacklist and the value is not "null"
1760-
if(propValue !== "null" && $.inArray(propName, blacklist) === -1) {
1750+
// If the currently traversed property value is not "null", is on the whitelist, or is an HTML 5 data attribute
1751+
if(propValue !== "null" && ($.inArray(propName, whitelist) !== -1 || propName.indexOf("data-") !== -1)) {
17611752

17621753
// Set's the currently traversed property on element
17631754
elem.attr(propName, propValue);

‎src/javascripts/jquery.selectBoxIt.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.