envjs 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.3.2 / 2010-04-21
2
+
3
+ * don't error out on empty options and handle options within optgroups
4
+
1
5
  === 0.3.1 / 2010-03-30
2
6
 
3
7
  * fix problem with set history fn name
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
- this.parentNode && (this.parentNode.value = this.value);
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
- for (i=0; i<this.parentNode.options.length; i++) {
6780
- if (this.parentNode.options[i].selected) {
6781
- anythingSelected = true;
6782
- break;
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
- this.parentNode.value = this.parentNode.options[0].value;
6791
+ if (!anythingSelected && parent.options) {
6792
+ parent.value = parent.options[0].value;
6787
6793
  }
6788
6794
  }
6789
6795
  }
data/lib/envjs.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Envjs
2
2
 
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
 
5
5
  def self.js_exception_stack e
6
6
  result = %(Exception: )+e.to_s
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
- this.parentNode && (this.parentNode.value = this.value);
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
- for (i=0; i<this.parentNode.options.length; i++) {
39
- if (this.parentNode.options[i].selected) {
40
- anythingSelected = true;
41
- break;
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
- this.parentNode.value = this.parentNode.options[0].value;
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
- - 1
9
- version: 0.3.1
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-03-30 00:00:00 -07:00
19
+ date: 2010-04-21 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency