[prev in list] [next in list] [prev in thread] [next in thread]
List: webkit-dev
Subject: [webkit-dev] Why it is not possible to appendChild on elements
From: Alexander Shabanov <avshabanov () gmail ! com>
Date: 2009-11-28 11:16:26
Message-ID: 43a7c3700911280316t6e5764fdp230ae89d18fbe468 () mail ! gmail ! com
[Download RAW message or body]
Hi all,
Sorry for silly question but I think that it might be a nice feature to webkit.
The following code works in Mozilla Firefox 3.5, but it does not work
in webkit-based browsers:
var parser = new DOMParser();
var str = "<p>This is a test</p>";
var doc = parser.parseFromString(str, "text/xml");
document.body.appendChild(doc.documentElement.firstChild);
I found that specification to DOMParser does not guarantee that the
result of DOMParser's parseFromX methods can
be directly used in the original document.
Nevertheless I believe that it would be quite a useful feature, at
least it won't require JS code to create DOM-compliant content from
the parsed one.
May be I missed something and webkit offers a way of quick adaptation
of the parsed content to the original DOM tree?
Thanks in advance.
P.S.: even though Firefox provides such a feature, a style
specification in the following code will take no effect:
var parser = new DOMParser();
var str = "<p style='color: red;'>This is a test</p>";
var doc = parser.parseFromString(str, "text/xml");
document.body.appendChild(doc.documentElement.firstChild);
--
Best regards,
Alexander Shabanov
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic