http://www.w3.org/TR/WCAG20-TECHS/SCR21.htmlThe objective of this technique is to demonstrate how to use functions of the Document Object Model (DOM) to add content to
a page instead of using document.write or object.innerHTML. The document.write() method does not work with XHTML when served
with the correct MIME type (application/xhtml+xml), and the innerHTML property is not part of the DOM specification and thus
should be avoided.
^ - Interessant
...
http://www.w3.org/WAI/GL/WCAG20/WD-WCAG20-SCRIPT-TECHS-20041008/2.2 Dynamic content generation
This technique relates to the following sections of the guidelines:
Task:
- Avoid document.write() and innerHTML().
Assistive technologies Additionally, document.write() and innerHTML() can render content invalid after the fact, which
presents problems for those assistive technologies that do support script.
Deprecated Example:
function fillContent() {
document.write("<h1>Welcome to my site</h1>");
document.write("<p>Lorem ipsum dolor sit amet");
document.menu.innerHTML = "<ul><li><a href="foo.html">foo</a>";
}
^ - Øhm, ja den fejl kan også laves i almindelig markup - er
der kun innerHTML's fejl at en fjumrende sætter forkert html ?
...
http://www.w3.org/TR/html5/dom.html2.2 Elements
The nodes representing HTML elements in the DOM must implement, and expose to scripts, the interfaces listed for them in the
relevant sections of this specification. This includes XHTML elements in XML documents, even when those documents are in
another context (e.g. inside an XSLT transform).
The basic interface, from which all the HTML elements' interfaces inherit, and which must be used by elements that have no
additional requirements, is the HTMLElement interface.
interface HTMLElement : Element {
// DOM tree accessors
NodeList getElementsByClassName(in DOMString classNames);
// dynamic markup insertion
attribute DOMString innerHTML;
^ - Hvad ?
---
2.5 Dynamic markup insertion
The document.write() family of methods and the innerHTML family of DOM attributes enable script authors to dynamically insert markup into the document.
bz argues that innerHTML should be called something else on XML documents and XML elements. Is the sanity worth the migration pain?
Because these APIs interact with the parser, their behavior varies depending on whether they are used with HTML documents (and the HTML parser) or XHTML in XML documents (and the XML parser). The following table cross-references the various versions of these APIs.
document.write() innerHTML
For documents that are HTML documents document.write() in HTML innerHTML in HTML
For documents that are XML documents document.write() in XML innerHTML in XML
Regardless of the parsing mode, the document.writeln(...) method must call the document.write() method with the same argument(s), and then call the document.write() method with, as its argument, a string consisting of a single line feed character (U+000A).
^ - Hvad ?
---
5.
Finally, the method must return.
In HTML, the innerHTML DOM attribute of all HTMLElement and HTMLDocument nodes returns a serialization of the node's children using the HTML syntax. On setting, it replaces the node's children with new nodes that result from parsing the given value. The formal definitions follow.
On getting, the innerHTML DOM attribute must return the result of running the HTML fragment serialization algorithm on the node.
On setting, if the node is a document, the innerHTML DOM attribute must run the following algorithm:
1.
If the document has an active parser, then stop that parser, and throw away any pending content in the input stream. what about if it doesn't, because it's either like a text/plain, or Atom, or PDF, or XHTML, or image document, or something?
2.
Remove the children nodes of the Document whose innerHTML attribute is being set.
3.
Create a new HTML parser, in its initial state, and associate ...
o.s.v.
^ - Hvad ?
---
Er det bare mig eller ser innerHTML ud til at være standardiseret adgangsflade i html5 ?