changeset 103:1c18434e5e69

Fix js for compatibility with Safari.
author Daniele Nicolodi <daniele@grinta.net>
date Sun, 21 Aug 2011 20:34:22 +0200
parents 92adea9630c8
children dcb2f0a97147
files src/ltpdarepo/static/dropdown.js src/ltpdarepo/static/querywidget.js
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/static/dropdown.js	Sun Aug 21 20:34:08 2011 +0200
+++ b/src/ltpdarepo/static/dropdown.js	Sun Aug 21 20:34:22 2011 +0200
@@ -103,7 +103,6 @@
         });
 
       $("dd ul li a", dropdown).click(function(e) {
-          $("dt a", dropdown).html($(this).html());
           $("dd ul", dropdown).hide();
           source.val($(this).find("span.value").text());
           source.change();
@@ -113,7 +112,7 @@
 
       source.bind('change', function() {
           var selected = $(this).find(":selected");
-          $("dt a", dropdown).html(selected.text());
+          $("dt a", dropdown).html(selected.html());
           var e = $("dd ul li", dropdown).filter(function (index) { return $('.value', this).text() == selected.val() });
           _set_current(e, dropdown);
         });
@@ -132,14 +131,14 @@
 
           var dropdown = $(document.createElement('dl'))
             .attr({'class': 'dropdown', 'tabindex': '0'})
-            .append('<dt><a>' + selected.text() +
+            .append('<dt><a>' + selected.html() +
                     '<span class="value">' + selected.val() +
                     '</span></a></dt><dd><ul></ul></dd></dl>');
 
           var list = $("dd ul", dropdown);
           options.each(function() {
               if ($(this).val()) {
-                  list.append('<li><a>' + $(this).text() +
+                  list.append('<li><a>' + $(this).html() +
                               '<span class="value">' + $(this).val() + '</span>' +
                               '</a></li>');
               }
--- a/src/ltpdarepo/static/querywidget.js	Sun Aug 21 20:34:08 2011 +0200
+++ b/src/ltpdarepo/static/querywidget.js	Sun Aug 21 20:34:22 2011 +0200
@@ -20,7 +20,7 @@
             name = val.name;
           }
           // create options
-          var option = $(document.createElement('option')).attr('value', id).html(name);
+          var option = $(document.createElement('option')).attr('value', id).text(name);
           if (i == selectedvalue) {
             option.attr('selected', 'selected');
           }