Skip to main content

Bug Tracker

Side navigation

#12696 closed bug (invalid)

Opened October 10, 2012 07:09PM UTC

Closed October 25, 2012 09:04AM UTC

Catch element in one line HTML with jQuery

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:

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, jQuery able to catch those elements that was unable before. What the reason?

HTML code before Code Beautifier:

<tr><td> <img alt="" src="images/46.jpg" usemap="#rade_img_map_1349882725177" /></td></tr>

HTML code after Code Beautifier:



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



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(' <img') > 0) {

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




Attachments (0)
Change History (2)

Changed October 10, 2012 07:11PM UTC by dmethvin comment:1

owner: →
status: newpending
"jQuery can't catch some elements"

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

Changed October 25, 2012 09:04AM UTC by trac-o-bot comment:2

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!