Skip to content
This repository

Add live check for Picker open status #103

Closed
wants to merge 1 commit into from

2 participants

Romain Laurent Arian Stolwijk
Romain Laurent

No description provided.

Arian Stolwijk
Owner
arian commented April 04, 2013

The opened state should be consistent and correct.

Arian Stolwijk arian closed this April 04, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 06, 2012
Romain Laurent Add live check for Picker open status 7afeb28
This page is out of date. Refresh to see the latest.
4  Source/Picker.Attach.js
@@ -73,7 +73,7 @@ Picker.Attach = new Class({
73 73
 		var getOpenEvent = function(element){
74 74
 			return function(event){
75 75
 				var tag = event.target.get('tag');
76  
-				if (tag == 'input' && event.type == 'click' && !element.match(':focus') || (self.opened && self.input == element)) return;
  76
+				if (tag == 'input' && event.type == 'click' && !element.match(':focus') || (self.opened() && self.input == element)) return;
77 77
 				if (tag == 'a') event.stop();
78 78
 				self.position(element);
79 79
 				self.open();
@@ -83,7 +83,7 @@ Picker.Attach = new Class({
83 83
 
84 84
 		var getToggleEvent = function(open, close){
85 85
 			return function(event){
86  
-				if (self.opened) close(event);
  86
+				if (self.opened()) close(event);
87 87
 				else open(event);
88 88
 			};
89 89
 		};
12  Source/Picker.js
@@ -125,9 +125,12 @@ var Picker = new Class({
125 125
 		}
126 126
 	},
127 127
 
  128
+  opened: function(){
  129
+    return this.picker.getStyle('display') == 'block' && this.picker.getStyle('opacity') == 1
  130
+  },
  131
+
128 132
 	open: function(noFx){
129  
-		if (this.opened == true) return this;
130  
-		this.opened = true;
  133
+		if (this.opened()) return this;
131 134
 		var self = this,
132 135
 			picker = this.picker.setStyle('display', 'block').set('aria-hidden', 'false')
133 136
 		if (this.shim) this.shim.show();
@@ -149,8 +152,7 @@ var Picker = new Class({
149 152
 	},
150 153
 
151 154
 	close: function(noFx){
152  
-		if (this.opened == false) return this;
153  
-		this.opened = false;
  155
+		if (!this.opened()) return this;
154 156
 		this.fireEvent('close');
155 157
 		var self = this, picker = this.picker, hide = function(){
156 158
 			picker.setStyle('display', 'none').set('aria-hidden', 'true');
@@ -171,7 +173,7 @@ var Picker = new Class({
171 173
 	},
172 174
 
173 175
 	toggle: function(){
174  
-		return this[this.opened == true ? 'close' : 'open']();
  176
+		return this[this.opened() ? 'close' : 'open']();
175 177
 	},
176 178
 
177 179
 	destroy: function(){
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.