Author: jablko
Date: Mon Sep 28 17:42:32 2009
New Revision: 3583

Log:
Avoid use of E4X, not supported by all browsers, fixes issue 1008 -- force

Modified:
   trunk/web/js/actions.js
   trunk/web/js/autocomplete.js
   trunk/web/js/select.js

Modified: trunk/web/js/actions.js
==============================================================================
--- trunk/web/js/actions.js     Mon Sep 28 17:39:44 2009        (r3582)
+++ trunk/web/js/actions.js     Mon Sep 28 17:42:32 2009        (r3583)
@@ -5,7 +5,7 @@
     {
       $('.actions').each(function ()
         {
-          var img = $(<img src={Qubit.relativeUrlRoot + 
'/sfDrupalPlugin/vendor/drupal/misc/menu-expanded.png'}/>.toXMLString()).replaceAll(this).get(0);
+          var img = $('<img src="' + Qubit.relativeUrlRoot + 
'/sfDrupalPlugin/vendor/drupal/misc/menu-expanded.png"/>').replaceAll(this).get(0);
 
           // HACK: YAHOO.widget.Menu() requires a string argument
           var menu = new YAHOO.widget.Menu(Math.random().toString(), { 
context: [img, 'tl', 'bl' ] });

Modified: trunk/web/js/autocomplete.js
==============================================================================
--- trunk/web/js/autocomplete.js        Mon Sep 28 17:39:44 2009        (r3582)
+++ trunk/web/js/autocomplete.js        Mon Sep 28 17:42:32 2009        (r3583)
@@ -32,18 +32,18 @@
 
               // Make autocomplete <input>, copy @class from <select>, copy @id
               // from <select> so <label for="..."> is correct
-              var input = $(<input class={$(this).attr('class')} 
id={$(this).attr('id')}/>.toXMLString()).insertAfter(this)[0]
+              var input = $('<input class="' + $(this).attr('class') + '" 
id="' + $(this).attr('id') + '"/>').insertAfter(this)[0]
 
               if ($(this).attr('multiple'))
               {
                 // If multiple <select>, make <ul> of selected <option>s
-                var ul = $(<ul/>.toXMLString()).insertAfter(this)[0];
+                var ul = $('<ul/>').insertAfter(this)[0];
 
                 $('option:selected', this).each(function ()
                   {
                     // Make <li> of hidden <input> with <option> value, and
                     // <span> with <option> HTML contents
-                    $(<li><input name={$(select).attr('name')} type="hidden" 
value={$(this).val()}/><span>{XML($(this).html())}</span></li>.toXMLString())
+                    $('<li><input name="' + $(select).attr('name') + '" 
type="hidden" value="' + $(this).val() + '"/><span>' + $(this).html() + 
'</span></li>')
                       .click(function ()
                         {
                           // On click, remove <li>
@@ -59,7 +59,7 @@
               {
                 // If single <select>, make one hidden <input> with <option>
                 // value,
-                var hidden = $(<input name={$(this).attr('name')} 
type="hidden" value={$(this).val()}/>.toXMLString()).insertAfter(this)[0];
+                var hidden = $('<input name="' + $(this).attr('name') + '" 
type="hidden" value="' + $(this).val() + '"/>').insertAfter(this)[0];
 
                 // - and copy <option> value to autocomplete <input>
                 $(input).val($('option:selected', this).text());
@@ -139,7 +139,7 @@
                   }
                 });
 
-              var autoComplete = new YAHOO.widget.AutoComplete(input, 
$(<div/>.toXMLString()).insertAfter(this)[0], dataSource);
+              var autoComplete = new YAHOO.widget.AutoComplete(input, 
$('<div/>').insertAfter(this)[0], dataSource);
 
               // Show some items even if user types nothing,
               // http://developer.yahoo.com/yui/autocomplete/#minquery
@@ -206,7 +206,7 @@
                       // <element>, but not, I suspect, for strings with
                       // multiple root <element>s or text outside the root
                       // <element>
-                      $(<li><input name={$(select).attr('name')} type="hidden" 
value={args[2][1]}/><span>{XML(args[2][0])}</span></li>.toXMLString())
+                      $('<li><input name="' + $(select).attr('name') + '" 
type="hidden" value="' + args[2][1] + '"/><span>' + args[2][0] + '</span></li>')
                         .click(function ()
                           {
                             // On click, remove <li>
@@ -234,7 +234,7 @@
                   //
                   // Use XML() constructor as with multiple <select>, but use
                   // toString() to get text of parsed HTML
-                  $(input).val(XML(args[2][0]));
+                  $(input).val($(args[2][0]).text());
                 });
 
               if ($(select).attr('multiple'))
@@ -297,7 +297,7 @@
                 //
                 // Append to <body> instead of insert after <select> to avoid
                 // interfering with tabbing between inputs
-                var iframe = $(<iframe src={src}/>.toXMLString())
+                var iframe = $('<iframe src="' + src + '"/>')
                   .width(0)
                   .height(0)
                   .css('border', 0)
@@ -351,7 +351,7 @@
                         }
 
                         // Add hidden <iframe> for each new choice
-                        var iframe = $(<iframe src={src}/>.toXMLString())
+                        var iframe = $('<iframe src="' + src + '"/>')
                           .width(0)
                           .height(0)
                           .css('border', 0)
@@ -369,7 +369,7 @@
                             {
                               // Make <input> with URI of new resource as its
                               // value
-                              $(<input name={$(select).attr('name')} 
value={this.contentDocument.location}/>.toXMLString()).appendTo(li);
+                              $('<input name="' + $(select).attr('name') + '" 
value="' + this.contentDocument.location + '"/>').appendTo(li);
 
                               // Decrement count of listeners and submit if all
                               // done
@@ -383,7 +383,7 @@
                         }
 
                         // Make <li>
-                        var li = $(<li/>.toXMLString())
+                        var li = $('<li/>')
                           .click(function (event)
                             {
                               // On click, remove <li> and cancel addition of

Modified: trunk/web/js/select.js
==============================================================================
--- trunk/web/js/select.js      Mon Sep 28 17:39:44 2009        (r3582)
+++ trunk/web/js/select.js      Mon Sep 28 17:42:32 2009        (r3583)
@@ -8,7 +8,7 @@
 
       // Make <li> of hidden <input> with <option> value, and <span> with
       // <option> HTML contents
-      $(<li><input name={name} type="hidden" 
value={$(option).val()}/><span>{XML($(option).html())}</span></li>.toXMLString())
+      $('<li><input name="' + name + '" type="hidden" value="' + 
$(option).val() + '"/><span>' + $(option).html() + '</span></li>')
         .click(function ()
           {
             // On click, remove <li> and enable <option>
@@ -29,7 +29,7 @@
           var name = $(this).attr('name');
 
           // Make <ul> of selected <option>s
-          var ul = $(<ul/>.toXMLString()).insertBefore(this)[0];
+          var ul = $('<ul/>').insertBefore(this)[0];
 
           $('option:selected', this).each(function ()
             {
@@ -38,7 +38,7 @@
             });
 
           // Add blank option for clearing <select>
-          var blank = $(<option/>.toXMLString())
+          var blank = $('<option/>')
             .attr('selected', 'selected')
             .prependTo(this)[0];
 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to