changeset 5437:3f017db297c4

javascript: use jQuery .prop instead of .attr for standard properties
author Mads Kiilerich <madski@unity3d.com>
date Wed, 26 Aug 2015 17:28:59 +0200
parents d2b9788d2760
children 68011c4e6f33
files kallithea/public/js/base.js kallithea/templates/admin/gists/edit.html kallithea/templates/admin/gists/new.html kallithea/templates/changeset/diff_block.html kallithea/templates/files/files_add.html kallithea/templates/files/files_edit.html kallithea/templates/pullrequests/pullrequest.html
diffstat 7 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/public/js/base.js	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/public/js/base.js	Wed Aug 26 17:28:59 2015 +0200
@@ -524,7 +524,7 @@
         // save org title
         $el.attr('tt_title', tipText);
         // reset title to not show org tooltips
-        $el.attr('title', '');
+        $el.prop('title', '');
 
         var $tipBox = $('#tip-box');
         if (safe) {
@@ -548,7 +548,7 @@
     var $tipBox = $('#tip-box');
     $tipBox.hide();
     var el = e.currentTarget;
-    $(el).attr('title', $(el).attr('tt_title'));
+    $(el).prop('title', $(el).attr('tt_title'));
 };
 
 /**
@@ -767,7 +767,7 @@
  */
 var linkInlineComments = function($firstlinks, $comments){
     if ($comments.length > 0) {
-        $firstlinks.html('<a href="#{0}">First comment</a>'.format($comments.attr('id')));
+        $firstlinks.html('<a href="#{0}">First comment</a>'.format($comments.prop('id')));
     }
     if ($comments.length <= 1) {
         return;
@@ -776,12 +776,12 @@
     $comments.each(function(i, e){
             var prev = '';
             if (i > 0){
-                var prev_anchor = $($comments.get(i-1)).attr('id');
+                var prev_anchor = $($comments.get(i-1)).prop('id');
                 prev = '<a href="#{0}">Previous comment</a>'.format(prev_anchor);
             }
             var next = '';
             if (i+1 < $comments.length){
-                var next_anchor = $($comments.get(i+1)).attr('id');
+                var next_anchor = $($comments.get(i+1)).prop('id');
                 next = '<a href="#{0}">Next comment</a>'.format(next_anchor);
             }
             $(this).find('.comment-prev-next-links').html(
@@ -976,7 +976,7 @@
                 $('body').prepend($hl_div);
             }
 
-            $hl_div.append($('<a>').html(_TM['Selection link']).attr('href', location.href.substring(0, location.href.indexOf('#')) + '#L' + ranges[0] + '-'+ranges[1]));
+            $hl_div.append($('<a>').html(_TM['Selection link']).prop('href', location.href.substring(0, location.href.indexOf('#')) + '#L' + ranges[0] + '-'+ranges[1]));
             var xy = $(till).offset();
             $hl_div.css('top', (xy.top + yoffset) + 'px').css('left', xy.left + 'px');
             $hl_div.show();
@@ -1184,7 +1184,7 @@
 
     // Handler for selection of an entry
     var itemSelectHandler = function (sType, aArgs) {
-        var nextId = $inputElement.attr('id').split('perm_new_member_name_')[1];
+        var nextId = $inputElement.prop('id').split('perm_new_member_name_')[1];
         var myAC = aArgs[0]; // reference back to the AC instance
         var elLI = aArgs[1]; // reference to the selected LI element
         var oData = aArgs[2]; // object literal of selected item's result data
@@ -1327,7 +1327,7 @@
 var removeReviewMember = function(reviewer_id, repo_name, pull_request_id){
     var $li = $('#reviewer_{0}'.format(reviewer_id));
     $li.find('div div').css("text-decoration", "line-through");
-    $li.find('input').attr('name', 'review_members_removed');
+    $li.find('input').prop('name', 'review_members_removed');
     $li.find('.reviewer_member_remove').replaceWith('&nbsp;(remove not saved)');
 }
 
@@ -1886,7 +1886,7 @@
 $(document).ready(function(){
     $('.diff-collapse-button').click(function(e) {
         var $button = $(e.currentTarget);
-        var $target = $('#' + $button.attr('target'));
+        var $target = $('#' + $button.prop('target'));
         if($target.hasClass('hidden')){
             $target.removeClass('hidden');
             $button.html("&uarr; {0} &uarr;".format(_TM['Collapse Diff']));
--- a/kallithea/templates/admin/gists/edit.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/admin/gists/edit.html	Wed Aug 26 17:28:59 2015 +0200
@@ -94,7 +94,7 @@
                         $(opt).attr('mode', m.mode);
                         if (m.mime == 'text/plain') {
                             // default plain text
-                            $(opt).attr('selected', 'selected');
+                            $(opt).prop('selected', true);
                             modes_select.options[0] = opt;
                         } else {
                             modes_select.options[index++] = opt;
--- a/kallithea/templates/admin/gists/new.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/admin/gists/new.html	Wed Aug 26 17:28:59 2015 +0200
@@ -72,7 +72,7 @@
                     $(opt).attr('mode', m.mode);
                     if (m.mime == 'text/plain') {
                         // default plain text
-                        $(opt).attr('selected', 'selected');
+                        $(opt).prop('selected', true);
                         modes_select.options[0] = opt;
                     } else {
                         modes_select.options[index++] = opt;
--- a/kallithea/templates/changeset/diff_block.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/changeset/diff_block.html	Wed Aug 26 17:28:59 2015 +0200
@@ -134,7 +134,7 @@
         $('.btn-image-diff-swap').show();
         $('.img-diff-swapable')
             .each(function(i,e){
-                    $(e).attr('src', $(e).attr('realsrc'));
+                    $(e).prop('src', $(e).attr('realsrc'));
                 })
             .show();
         });
--- a/kallithea/templates/files/files_add.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/files/files_add.html	Wed Aug 26 17:28:59 2015 +0200
@@ -79,7 +79,7 @@
                     $(opt).attr('mode', m.mode);
                     if (m.mime == 'text/plain') {
                         // default plain text
-                        $(opt).attr('selected', 'selected');
+                        $(opt).prop('selected', true);
                         modes_select.options[0] = opt;
                     } else {
                         modes_select.options[index++] = opt;
--- a/kallithea/templates/files/files_edit.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/files/files_edit.html	Wed Aug 26 17:28:59 2015 +0200
@@ -87,7 +87,7 @@
             $(opt).attr('mode', m.mode);
             if (m.mime == 'text/plain') {
                 // default plain text
-                $(opt).attr('selected', 'selected');
+                $(opt).prop('selected', true);
                 modes_select.options[0] = opt;
             } else {
                 modes_select.options[index++] = opt;
@@ -98,7 +98,7 @@
     var detected_mode = CodeMirror.findModeByExtension("${c.file.extension}");
     if(detected_mode){
         setCodeMirrorMode(myCodeMirror, detected_mode);
-        $($('#set_mode option[value="'+detected_mode.mime+'"]')[0]).attr("selected", "selected");
+        $($('#set_mode option[value="'+detected_mode.mime+'"]')[0]).prop('selected', true);
     }
 
     $('#set_mode').on('change', function(e){
--- a/kallithea/templates/pullrequests/pullrequest.html	Wed Aug 26 17:28:58 2015 +0200
+++ b/kallithea/templates/pullrequests/pullrequest.html	Wed Aug 26 17:28:59 2015 +0200
@@ -129,7 +129,7 @@
               $other_ref.empty();
               for(var i = 0; i < data.refs.length; i++)
               {
-                var $optgroup = $('<optgroup/>').attr('label', data.refs[i][1]);
+                var $optgroup = $('<optgroup/>').prop('label', data.refs[i][1]);
                 var options = data.refs[i][0];
                 var length = options.length;
                 for(var j = 0; j < length; j++)