Firefox 3 beta3 problem

R

Rauan Maemirov

I've got wysiwyg-editor, that worked fine on ff 2. But now i'm testign
it on ff3b3.

var getDoc = this.wysiwyg.contentWindow.document;
var html = document.createTextNode(getDoc.body.innerHTML);
getDoc.body.innerHTML = '';
getDoc.body.appendChild(html); // this code throws exception 'Node
cannot be used in a document other than the one in which it was
created" code: "4 Line 0'
 
T

Thomas 'PointedEars' Lahn

Rauan said:
I've got wysiwyg-editor, that worked fine on ff 2. But now i'm testign
it on ff3b3.

var getDoc = this.wysiwyg.contentWindow.document;
var html = document.createTextNode(getDoc.body.innerHTML);

var html = getDoc.createTextNode(getDoc.body.innerHTML);
getDoc.body.innerHTML = '';

Should be

var b = getDoc.body, c;
while ((c = b.firstChild))
{
b.removeChild(c);
}

But since you are using `innerHTML' anyway ...
getDoc.body.appendChild(html); // this code throws exception 'Node
cannot be used in a document other than the one in which it was
created" code: "4 Line 0'

Is this an attempt to display the source code of the iframe document?


PointedEars
 
R

Rauan Maemirov

Should be

  var b = getDoc.body, c;
  while ((c = b.firstChild))
  {
    b.removeChild(c);
  }

Tried this, but didn't help. Exception occurs anyway.

Is this an attempt to display the source code of the iframe document?

Yes.
 
T

Thomas 'PointedEars' Lahn

Rauan said:
Tried this, but didn't help. Exception occurs anyway.

You overlooked the more important suggestion above this one.

Then you should know that the `innerHTML' serialization of the subtree does
not necessarily represent that source code.


PointedEars
 
S

SAM

Rauan Maemirov a écrit :
I've got wysiwyg-editor, that worked fine on ff 2. But now i'm testign
it on ff3b3.

var getDoc = this.wysiwyg.contentWindow.document;
var html = document.createTextNode(getDoc.body.innerHTML);
getDoc.body.innerHTML = '';
getDoc.body.appendChild(html); // this code throws exception 'Node
cannot be used in a document other than the one in which it was
created" code: "4 Line 0'

Perhaps ... :

var getDoc = this.wysiwyg.contentWindow.document;
var html = getDoc.createTextNode(getDoc.body.innerHTML);
getDoc.body.innerHTML = '';
getDoc.body.appendChild(html);

or :

var getDoc = this.wysiwyg.contentWindow.document;
var html = getDoc.createTextNode(getDoc.body.innerHTML);
while(getDoc.body.hasChildNodes())
getDoc.body.removeChild(getDoc.body.firstChild);
getDoc.body.appendChild(html);

or (this one would have to be OK) :

var getDoc = this.wysiwyg.contentWindow.document;
var html = [];
while(getDoc.body.hasChildNodes())
html[html.length] = getDoc.body.removeChild(getDoc.body.firstChild);
for(var i=0; i<html.length; i++) {
if(html.tagName) html.style.color = 'red';
getDoc.body.appendChild(html);
}

or :

var getDoc = this.wysiwyg.contentWindow.document;
var html = getDoc.innerHTML;
getDoc.body.innerHTML = '';
getDoc.body.innerHTML = html;
 
R

Rauan Maemirov

Perhaps ... :

var getDoc = this.wysiwyg.contentWindow.document;
var html = getDoc.createTextNode(getDoc.body.innerHTML);
getDoc.body.innerHTML = '';
getDoc.body.appendChild(html);

Thanks, SAM!!! This code works fine. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top