Skip to content

encodeForHTMLAttribute  #9

@ricmetal

Description

@ricmetal

is there any problem with reverting the order of apostrophes:

title= ' " + $.encoder.encodeForHTMLAttribute(var) + " '
and
title= " ' + $.encoder.encodeForHTMLAttribute(var) + ' "

do they work interchangeably? i thought i saw the example with a different apostrophe order than the one i am using - in my case the order i have doesn't seem to work. the data being treated isnt even printed. it actually seems to break the line of code it is in, which is a simple elemnt creation, with the img's default attributes, src, alt and title.

using encodeForHTML allows the data to be printed, but the data is not treated correctly, as the single apostrophe in the data closes the attribute...

here is the code, ive interchanged the apostrophes but the result (fail) is the same..i dont know why. is the img title attribute not an attribute?

var imgBoxes = '';
                    for(var n = 0; n < items; n++){
                        imgBoxes += '<div id="imgBox' + parentArray[n][0] + '" class="image-box image-box-unselected"><img src="gallery/' + userId + '/exhibitions/' + parentArray[n][1] + '" title="" alt="' + ls_glob_img_alt + '"><div class="photo-icons"><img src="' + ls_glob_del_src + '" onclick="delPic_confirm(\'' + parentArray[n][0] + '\', \'manage\'); this.blur();" class="pointer del-photo-icon invisible ttip" alt="' + ls_glob_del_txt + '" title="' + $.encoder.encodeForHTMLAttribute(ls_glob_dpb_title) + '"> <img src="' + ls_glob_edit_src + '" id="epi' + parentArray[n][0] + '" class="pointer edit-photo-icon invisible ttip" alt="' + ls_glob_epd_title + '" title="' + ls_glob_edit_at + '"></div></div>';
                    }
                    $('#galleryScroller_div').append(imgBoxes);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions