Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12696 closed bug (invalid)

Catch element in one line HTML with jQuery

Reported by: konstantin.fedoseev@… Owned by: konstantin.fedoseev@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

Description

We have CMS system, users can add HTML content with WYSIWYG editor. I need to find all images inside the editor that have image maps and remove blank space before those images.

We discovered the problem that jQuery can't catch some elements when whole HTML code of the editor represented as one line. But when we run the code via http://jsbeautifier.org/, jQuery able to catch those elements that was unable before. What the reason?

HTML code before Code Beautifier: <tr><td>&nbsp;<img alt="" src="images/46.jpg" usemap="#rade_img_map_1349882725177" /></td></tr>

HTML code after Code Beautifier:

<tr>

<td>

&nbsp;<img alt="" src="images/46.jpg" usemap="#rade_img_map_1349882725177" />

</td>

</tr>

jQuery function:

function FixBlankSpaces() { var editorContents = $('#editEditor_contentIframe').contents(); $(editorContents).find('img[usemap]').each(function () {

var currentElement = $(this); var thisContent = $(currentElement).parent().html();

/Here the jQuery get's in trouble

if (thisContent.indexOf('&nbsp;<img') > 0) {

$('#editEditor_contentIframe').contents().find($(currentElement)).parent().html($('#editEditor_contentIframe').contents().find($(currentElement)).parent().html().replace(/&nbsp;/g, ));

}

});

}

Change History (2)

comment:1 Changed 7 years ago by dmethvin

Owner: set to konstantin.fedoseev@…
Status: newpending

"jQuery can't catch some elements"

I don't understand what this means. Can you post a test case on jsfiddle.net?

comment:2 Changed 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.