It is currently Sat Dec 02, 2017 4:06 pm
Advanced search
Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.
by PMB9 » Mon Mar 23, 2009 2:59 pm
Are there any reasons against document.write() for XML? Why don't do it like with innerHTML? May you can introduce document.XMLwrite().
- Code: Select all
<h1>Example page</h1>
<script><![CDATA[
document.write("<p>Hello World</p>")
]]></script>
→ no XML problem
<p>Hello
<script><![CDATA[
document.write("World</p>")
]]></script>
→ document.write will return an error because of malformed XML code ("World</p>")
-
PMB9
- <h3>
-
- Posts: 50
- Joined: Sat Jan 26, 2008 5:38 pm
by zcorpan » Fri Mar 27, 2009 4:48 am
What do you do when the script element is the root element?
-
zcorpan
- <article>
-
- Posts: 807
- Joined: Tue Feb 06, 2007 8:29 pm
- Location: Sweden
by JAB Creations » Fri Mar 27, 2009 5:14 am
document.write is proprietary JavaScript and has nothing to do with HTML5. It's time you spent some time reading about JavaScript nodes (which is software developer speak for elements).
Example...
http://www.w3schools.com/dom/dom_node.asp
-
JAB Creations
- <aside>
-
- Posts: 566
- Joined: Tue Mar 13, 2007 4:48 am
- Location: Sarasota Florida, USA
by PMB9 » Fri Apr 17, 2009 9:25 am
zcorpan wrote:What do you do when the script element is the root element?
Let's see what firefox does with text/html:
- Code: Select all
<!DOCTYPE HTML>
<script>
document.write('<title>Example page</title>')
document.write('<p>Hello World!</p>')
</script>
-->
- Code: Select all
<html><head>
<script>
document.write('<title>Example page</title>')
document.write('<p>Hello World!</p>')
</script><title>Example page</title></head><body><p>Hello World!</p></body></html>
So I propose for this XML example:
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
document.write('<title>Example page</title>')
document.write('<p>Hello World!</p>')
]]></script>
-->
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<script><![CDATA[
document.write('<title>Example page</title>')
document.write('<p>Hello World!</p>')
]]></script><title>Example page</title></head><body><p>Hello World</p></body></html>
-
PMB9
- <h3>
-
- Posts: 50
- Joined: Sat Jan 26, 2008 5:38 pm
by JAB Creations » Fri Apr 17, 2009 11:04 am
Learn real XHTML which is served as application/xhtml+xml which will not work with document.write. You're essentially proposing that HTML5 uses a hammer for a screw instead of a screwdriver.
-
JAB Creations
- <aside>
-
- Posts: 566
- Joined: Tue Mar 13, 2007 4:48 am
- Location: Sarasota Florida, USA
by PMB9 » Fri Apr 17, 2009 12:43 pm
I actually do serve XHTML pages as application/xhtml+xml. I don't know your 'screwdriver' solution. Are you able to explain it to me?
-
PMB9
- <h3>
-
- Posts: 50
- Joined: Sat Jan 26, 2008 5:38 pm
Return to Feedback on the Specs
Who is online
Users browsing this forum: No registered users and 1 guest