...

View Full Version : Resolved NotFoundError



BubikolRamios
12-07-2012, 02:22 AM
Anyone with idea why I get not found ?



var rightElement = document.getElementById(rightUUID);
var leftElement = document.getElementById(leftUUID);
alert(leftElement);//--> [ObjectHTMLSpanElement]

var range = document.createRange();
range.setStartAfter(leftElement);
range.setEndBefore(rightElement);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);

document.body.removeChild(rightElement);//-->No error
document.body.removeChild(leftElement);//-->NotFoundError: Node was not found

Old Pedant
12-07-2012, 02:32 AM
Can you show it live in a page?

BubikolRamios
12-07-2012, 02:56 AM
under construction on local host with ton of code around ...will do sample ......

Old Pedant
12-07-2012, 03:03 AM
thanks...hard to reproduce that without knowing what you started from.

BubikolRamios
12-07-2012, 03:18 AM
Sample: http://agrozoo.net/test/test5.html

See firebug error console, also the added spans does not disapear (inspecting with firebug), should they ? I mean, plan is that they should.

EDIT: They don't disapear coz of error, doh strange as document.getElementById(.. finds them (hence I think DOM refresh or something would not help).

BubikolRamios
12-07-2012, 03:54 AM
ahh, yes:



rightElement.parentNode.removeChild(rightElement);
leftElement.parentNode.removeChild(leftElement);

Old Pedant
12-07-2012, 08:33 PM
Elegant fix!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum