public
Description: Prototype UI
Homepage: http://prototype-ui.com
Clone URL: git://github.com/xilinus/prototypeui.git
fix FF3 and debug tokens serialisation in auto-complete
sgruhier (author)
Sun Jul 20 04:32:44 -0700 2008
commit  bd14194a011bdc60796135e583045fea5ba7eb6f
tree    978cf45382051436454133cd10968027a50a2d9a
parent  43637ab7afca0f7e43dd3818a084df5b1f2bbaf3
...
1
 
...
 
1
0
@@ -1 +1 @@
0
-Subproject commit 988e4cbafb3b45b91e80f96947afa0c217ca32e8
0
+Subproject commit f46ae6877af6fd02125f8d61bf953413ae115fbf
...
21
22
23
24
 
25
26
27
...
515
516
517
518
 
519
520
521
522
523
524
525
 
526
527
528
529
530
531
 
 
 
 
 
 
 
 
 
532
533
534
...
21
22
23
 
24
25
26
27
...
515
516
517
 
518
519
520
521
522
523
524
 
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
0
@@ -21,7 +21,7 @@ UI.AutoComplete = Class.create(UI.Options, {
0
     delay: 0.2, // Delay before running ajax request
0
     shadow: false, // Shadow theme name (false = no shadow)
0
     highlight: false, // Highlight search string in list
0
- tokens: false, // Tokens used to automatically adds a new entry (ex tokens:[',', ' '] for coma and spaces)
0
+ tokens: false, // Tokens used to automatically adds a new entry (ex tokens:[KEY_COMA, KEY_SPACE] for coma and spaces)
0
     unique: true // Do not display in suggestion a selected value
0
   },
0
   
0
@@ -515,20 +515,29 @@ UI.AutoComplete = Class.create(UI.Options, {
0
   updateSelectedText: function() {
0
     var selected = this.container.select("li." + this.getClassName("box"));
0
     var content = selected.collect(function(element) {return element.down("span").firstChild.textContent});
0
- var separator = this.options.tokens ? this.options.tokens.first() : " ";
0
+ var separator = this.getSeparatorChar();
0
     this.selectedText = content.empty() ? false : content.join(separator);
0
     
0
     return this;
0
   },
0
   
0
   updateHiddenField: function() {
0
- var separator = this.options.tokens ? this.options.tokens.first() : " ";
0
+ var separator = this.getSeparatorChar();
0
     this.hidden.value = this.selectedText ? $A([this.selectedText, this.input.value]).join(separator) : this.input.value;
0
   },
0
   
0
   selectedValues: function() {
0
     var selected = this.container.select("li." + this.getClassName("box"));
0
     return selected.collect(function(element) {return element.readAttribute("pui-autocomplete:value")});
0
+ },
0
+
0
+ getSeparatorChar: function() {
0
+ var separator = this.options.tokens ? this.options.tokens.first() : " ";
0
+ if (separator == Event.KEY_COMA)
0
+ separator = ',';
0
+ if (separator == Event.KEY_SPACE)
0
+ separator = ' ';
0
+ return separator;
0
   }
0
 });
0
 
...
3
4
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0
@@ -3,4 +3,18 @@
0
  * The Carousel section
0
  **/
0
 
0
+/** section: Carousel
0
+ * Carousel
0
+ *
0
+ * blablabla
0
+ **/
0
+
0
+/** section: Carousel
0
+ * new UI.Carousel(element, options)
0
+ * the Ajax Request constructor
0
+ **/
0
+
0
+/** section: Carousel
0
+ * class UI.Carousel
0
+ **/
0
 
...
36
37
38
39
 
40
41
42
...
119
120
121
 
 
 
 
122
123
124
...
36
37
38
 
39
40
41
42
...
119
120
121
122
123
124
125
126
127
128
0
@@ -36,7 +36,7 @@ var CSS = (function() {
0
   };
0
 
0
   // Fixes a stylesheet
0
- function fixStylesheet(stylesheet, method) {
0
+ function fixStylesheet(stylesheet, method) {
0
     // Parse import files
0
     if (stylesheet.imports)
0
       $A(stylesheet.imports).each(fixStylesheet);
0
@@ -119,6 +119,10 @@ var CSS = (function() {
0
     },
0
 
0
     preloadImages: function() {
0
+ // Does not work with FF3!!
1
+ if (navigator.userAgent.match(/Firefox\/3/))
0
+ return;
0
+
0
       parseStylesheet.apply(this, $A(arguments).concat(preloadRule));
0
     }
0
   };
...
30
31
32
33
 
34
35
36
...
30
31
32
 
33
34
35
36
0
@@ -30,7 +30,7 @@
0
     </form>
0
     <br/><br/>
0
     <script type="text/javascript">
0
- document.whenReady(function() {
0
+ Event.observe(window, 'load', function() {
0
       ac = new UI.AutoComplete('pui-demo', { shadow: "auto_complete",
0
                                              tokens: Event.KEY_COMA,
0
                                              max: {selection: 10, selected:5}

Comments

  • kangax Sun Jul 20 07:51:06 -0700 2008 at src/util/css.js L49

    What exactly was wrong with FF3?

  • xilinus Tue Jul 29 00:27:04 -0700 2008

    FF3 does not like stylesheet parsing

    This line:
    $A(stylesheet.rules || stylesheet.cssRules).each….

  • kangax Tue Jul 29 05:13:08 -0700 2008

    We should get rid of sniffing in favor of a feature test:

    // FF3
    var isCssRulesSameOriginPolicy = (function(){
    var ss = $A(document.styleSheets);
    try {
    ss.each(function(s){ s.cssRules });
    } catch(e) {
    return true;
    }
    return false;
    })();