comparison client/digitallibrary/jquery/jquery.digilib.js @ 863:ca2c022a9baa jquery

keep title and alt attributes from HTML for scaler img
author hertzhaft
date Sat, 12 Mar 2011 21:58:06 +0100
parents a135f590275d
children e5caceb1832b
comparison
equal deleted inserted replaced
862:a135f590275d 863:ca2c022a9baa
978 // embedded mode -- try to keep img tag 978 // embedded mode -- try to keep img tag
979 $elem.addClass('dl_embedded'); 979 $elem.addClass('dl_embedded');
980 scalerUrl = getScalerUrl(data); 980 scalerUrl = getScalerUrl(data);
981 $img = $elem.find('img'); 981 $img = $elem.find('img');
982 if ($img.length > 0) { 982 if ($img.length > 0) {
983 //oldUrl = $img.attr('src'); 983 var oldUrl = $img.attr('src');
984 //if (oldUrl === scalerUrl) { 984 // keep img attributes from html
985 // console.debug("img detach:", $img); 985 var title = $img.attr('title');
986 // $img.detach(); 986 var alt = $img.attr('alt');
987 //} else { 987 if (oldUrl === scalerUrl) {
988 // $img = $('<img/>'); 988 console.debug("img detach:", $img);
989 // keep title, alt etc. attributes (src gets changed anyway) 989 $img.detach();
990 $img.detach(); 990 } else {
991 $img = $('<img/>');
992 $img.attr("title", title);
993 $img.attr("alt", alt);
991 } 994 }
992 } else { 995 } else {
993 $img = $('<img/>'); 996 $img = $('<img/>');
994 } 997 }
995 } 998 }