>> iframe.contentDocument.open();
This piece of code giving me "null" exception in following version of
mozilla
SeaMonkey 1.0a mozilla/5.0 (Windows; U; Windows NT 5.0;
en-US; rv:1.8a5) Gecko/20050201
It seems to me, contentDocument.open() is not supported now.
is there any alternate for that, or I am doing something wrong.
Thanks,
-hitesh.
>>
iframe.contentDocument.write(htmlMarkup);
>>
iframe.contentDocument.close();
>
> Hi
martin,
>
Really thx for your help for converting a html string into DOM
> for
manipulation. Appreciate very much! The code works but right now i need
>
to render the DOM so i can find the x and y coord of all the html tags. Do
> you have any idea of how to display/render this DOM ? I try using the
one
> below but it only can render a html file or url
> "Martin
Honnen" <
mahotrash <at> yahoo.de> wrote
in message
>
news:da1091$3g1 <at> ripley.netscape.com...
>>
>>
>>
Ken Theng wrote:
>>
>>> Yep , you are right ! I tried that
but does not work cos it doesnt
>>> support text/html. Do u have
any idea how to do it ?
>>
>> As far as I understand there is
currently no API in Mozilla to simply
>> parse a string as HTML into a
DOM document, all HTML parsing is somehow
>> tied to rendering and
laying out documents always doing stuff like loading
>> stylesheets
and loading and executing scripts.
>> But that is an understanding
based solely from earlier responses in
>> newsgroups so not a very
qualified one. I think Boris is back in July, he
>> can tell you more
on such stuff.
>>
>> All I could contribute to a solution is
script creating an (X)HTML iframe
>> element, inserting it into an
existing document and then using
>> document.write to have the HTML
string parsed e.g.
>>
>> function parseHTML (htmlMarkup)
{
>> var iframe =
document.createElementNS('http://www.w3.org/1999/xhtml',
>>
'iframe');
>> iframe.style.display =
'none';
>> if (document.body)
{
>>
document.body.appendChild(iframe);
>>
}
>> else {
>>
document.documentElement.appendChild(iframe);
>>
}
>> iframe.contentDocument.open();
>>
iframe.contentDocument.write(htmlMarkup);
>>
iframe.contentDocument.close();
>> return
iframe.contentDocument;
>> }
>>
>> var doc =
parseHTML([
>> '<html>',
>>
'<head><title>test</title></head>',
>>
'<body><p>Kibology for
all.</p></body>',
>>
'</html>'
>> ].join('\r\n'));
>>
>> // now use
doc here
>>
>> --
>>
>> Martin
Honnen
>>
http://JavaScript.FAQTs.com/ >
>
> _______________________________________________
>
mozilla-dom mailing list
> >
http://mail.mozilla.org/listinfo/mozilla-dom