Changeset 899
- Timestamp:
- 10/10/07 21:04:29 (6 years ago)
- Files:
-
- 1 modified
-
trunk/modules/InsertImage/insert_image.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/InsertImage/insert_image.js
r733 r899 63 63 if ( image ) 64 64 { 65 outparam = 65 function getSpecifiedAttribute(element,attribute) 66 { 67 var a = element.attributes; 68 for (var i=0;i<a.length;i++) 69 { 70 if (a[i].nodeName == attribute && a[i].specified) 71 { 72 return a[i].value; 73 } 74 } 75 return ''; 76 } 77 /* if you want to understand why the above function is required, uncomment the two lines below and launch InsertImage in both Mozilla & IE with an image selected that hath neither value set and compare the results 78 alert(image.vspace +' '+ image.getAttribute('vspace') + ' ' + image.getAttribute('vspace',2) + ' ' + getSpecifiedAttribute(image,'vspace') ); 79 alert(image.hspace +' '+ image.getAttribute('hspace') + ' ' + image.getAttribute('hspace',2) + ' ' + getSpecifiedAttribute(image,'hspace') ); 80 */ 81 outparam = 66 82 { 67 83 f_base : base, 68 f_url : Xinha.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"),84 f_url : image.getAttribute('src',2), // the second parameter makes IE return the value as it is set, as opposed to an "interpolated" (as MSDN calls it) value 69 85 f_alt : image.alt, 70 86 f_border : image.border, 71 87 f_align : image.align, 72 f_vert : (image.vspace!=-1 ? image.vspace : ""), //FireFox reports -1 when this attr has no value.73 f_horiz : (image.hspace!=-1 ? image.hspace : ""), //FireFox reports -1 when this attr has no value.88 f_vert : getSpecifiedAttribute(image,'vspace'), 89 f_horiz : getSpecifiedAttribute(image,'hspace'), 74 90 f_width : image.width, 75 91 f_height : image.height … … 149 165 break; 150 166 case "f_vert": 151 if (value )167 if (value != "") 152 168 img.vspace = parseInt(value || "0"); 153 169 else … … 155 171 break; 156 172 case "f_horiz": 157 if (value )173 if (value != "") 158 174 img.hspace = parseInt(value || "0"); 159 175 else
