Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12505 closed bug (duplicate)

replaceWith in google chrome giving error

Reported by: sksallaj@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:

Description

Okay, I didn't know if I should go to a google chrome forum or to this forum and report the bug but only seemed to happen on a chrome browser, but a minor issue with firefox.

Originally I posted a design issue in stackover flow found here:

http://stackoverflow.com/questions/12357940/tabbing-through-span-elements-with-keydown-and-focusout-conflicts

I was having a problem that was on a larger scale happening on the project, so I figured I'd replicate it again to see if it does the same thing, and it does.

I was able to trim down the code into something I was able to replicate.

http://jsfiddle.net/QcGag/3/

Here are the results: In IE 7,8, and 9, the code worked perfectly

In google chrome: I got an: Uncaught Error: NOT_FOUND_ERR: DOM Exception 8

It took me to the code in jquery: "

keepData is for internal use only--do not document remove: function( selector, keepData ) {

for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {

if ( !selector
jQuery.filter( selector, [ elem ] ).length ) {

if ( !keepData && elem.nodeType === 1 ) {

jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] );

}

if ( elem.parentNode ) {

Uncaught Error: NOT_FOUND_ERR: DOM Exception 8 elem.parentNode.removeChild( elem );

}

}

}

"

In firefox: It worked, but I couldn't override the tab functionality, as I tried using e.preventDefault. I kept losing focus of the web document as it was being focused on other fields belonging to the browser. If I switched the keycode to a carriage return keycode == 13, it would work.

Change History (2)

comment:1 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #11663.
Repro with some problems fixed, like duplicate ID values: http://jsfiddle.net/QcGag/5/

It's not something we can fix, Chrome should not be throwing this. All we could do is catch it but wrapping that with a try/catch is a pretty ugly solution.

comment:2 Changed 11 years ago by sksallaj@…

Ah thanks, I'll post a notice to chrome's developer forum.

The work around for now was to wrap the spans within another span

so: <span id="test1" class="test">Test1</span> would be: <span id="parent_test1"><span id="test1" class="test">Test1</span></span>

Then I used jquery to do this:

$("#edit_"+cellInfo.cID).parent().empty(); $("#parent_"+cellInfo.cID).append(cellElem.old_elem.context.outerHTML);

That allowed me to do the same thing and get to where I wanted.

Note: See TracTickets for help on using tickets.