envjs 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +4 -0
- data/lib/envjs/static.js +13 -7
- data/lib/envjs.rb +1 -1
- data/src/html/option.js +13 -7
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/lib/envjs/static.js
CHANGED
@@ -6769,21 +6769,27 @@ __extend__(HTMLOptionElement.prototype, {
|
|
6769
6769
|
return;
|
6770
6770
|
}
|
6771
6771
|
HTMLInputCommon.prototype.setAttribute.call(this, 'selected', selectedValue);
|
6772
|
+
var parent = this.parentNode;
|
6773
|
+
while (parent.tagName === "OPTGROUP") {
|
6774
|
+
parent = parent.parentNode;
|
6775
|
+
}
|
6772
6776
|
if (value) {
|
6773
6777
|
// set select's value to this option's value (this also
|
6774
6778
|
// unselects previously selected value)
|
6775
|
-
|
6779
|
+
parent && (parent.value = this.value);
|
6776
6780
|
} else {
|
6777
6781
|
// if no other option is selected, select the first option in the select
|
6778
6782
|
var i, anythingSelected;
|
6779
|
-
|
6780
|
-
|
6781
|
-
|
6782
|
-
|
6783
|
+
if (parent.options) {
|
6784
|
+
for (i=0; i<parent.options.length; i++) {
|
6785
|
+
if (parent.options[i].selected) {
|
6786
|
+
anythingSelected = true;
|
6787
|
+
break;
|
6788
|
+
}
|
6783
6789
|
}
|
6784
6790
|
}
|
6785
|
-
if (!anythingSelected) {
|
6786
|
-
|
6791
|
+
if (!anythingSelected && parent.options) {
|
6792
|
+
parent.value = parent.options[0].value;
|
6787
6793
|
}
|
6788
6794
|
}
|
6789
6795
|
}
|
data/lib/envjs.rb
CHANGED
data/src/html/option.js
CHANGED
@@ -28,21 +28,27 @@ __extend__(HTMLOptionElement.prototype, {
|
|
28
28
|
return;
|
29
29
|
}
|
30
30
|
HTMLInputCommon.prototype.setAttribute.call(this, 'selected', selectedValue);
|
31
|
+
var parent = this.parentNode;
|
32
|
+
while (parent.tagName === "OPTGROUP") {
|
33
|
+
parent = parent.parentNode;
|
34
|
+
}
|
31
35
|
if (value) {
|
32
36
|
// set select's value to this option's value (this also
|
33
37
|
// unselects previously selected value)
|
34
|
-
|
38
|
+
parent && (parent.value = this.value);
|
35
39
|
} else {
|
36
40
|
// if no other option is selected, select the first option in the select
|
37
41
|
var i, anythingSelected;
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
if (parent.options) {
|
43
|
+
for (i=0; i<parent.options.length; i++) {
|
44
|
+
if (parent.options[i].selected) {
|
45
|
+
anythingSelected = true;
|
46
|
+
break;
|
47
|
+
}
|
42
48
|
}
|
43
49
|
}
|
44
|
-
if (!anythingSelected) {
|
45
|
-
|
50
|
+
if (!anythingSelected && parent.options) {
|
51
|
+
parent.value = parent.options[0].value;
|
46
52
|
}
|
47
53
|
}
|
48
54
|
}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John Resig
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-04-21 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|