Skip to content

Commit

Permalink
Slight adjustments after seeing it live.
Browse files Browse the repository at this point in the history
  • Loading branch information
sun committed Nov 12, 2011
1 parent 7848650 commit 44f6573
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions README.md
Expand Up @@ -8,24 +8,26 @@ innerHTML produces invalid XHTML. Instead of a big string, innerXHTML reads and

### Functions

#### `innerXHTML(Node|String node)`
innerXHTML(Node|String node)

Reads a DOM tree of Node or the DOM node identified by the HTML ID string, and returns a text string of the contained XHTML markup.

#### `innerXHTML(Node|String node, String htmlString [, mixed prependTo = false])`
innerXHTML(Node|String node, String htmlString [, mixed prependTo = false])

Writes a DOM tree from a passed in `htmlString` containing XHTML markup to the `Node` or the DOM node identified by the HTML ID string.
Writes a DOM tree from a passed in htmlString containing XHTML markup to Node or the DOM node identified by the HTML ID string.

The optional `prependTo` argument dictates where the markup is inserted:
The optional prependTo argument dictates where the markup is inserted:

- `false`: (default) Replaces all children of `Node`.
- false: (default) Replaces all children of Node.
- DOMNode: A DOM node. htmlString is inserted before it.
- ID: A HTML ID string suitable for document.getElementById(). htmlString is inserted before it.
- `true`: Appends htmlString to `Node`.
- true: Appends htmlString to Node.

#### `translateXHTML(String htmlString)`
.

Translates a string containing XHTML and XML markup into nodes for insertion into the DOM.
translateXHTML(String htmlString)

Internal. Translates a string containing XHTML and XML markup into nodes for insertion into the DOM.

### Reading and parsing DOM elements

Expand All @@ -39,7 +41,7 @@ With innerXHTML:
var container = document.getElementById('container');
var code = innerXHTML(container);

This returns the content of `#container` as a XHTML markup string.
This returns the content of #container as a XHTML markup string.

### Writing and serializing DOM elements

Expand All @@ -55,28 +57,25 @@ With innerXHTML:
var markup = '<div id="content"><p class="text">Hello world!</p></div>';
var code = innerXHTML(container, markup);

This replaces the content of `#container` with the HTML in `markup` as XHTML.
This replaces the content of #container with the HTML in markup as XHTML.

## Compatibility

innerXHTML aims to be cross-browser compatible. Browsers not listed here haven't been tested yet, but will likely work, too. If you test browsers not mentioned here, let us know of your testing results.

<table id="compat">
<thead>
<tr><th>Browser</th> <th>Platform</th> <th>Comments</th></tr>
<tr><th>Browser</th> <th>Platform</th> <th align="left">Comments</th></tr>
</thead>
<tbody>
<tr><td>Camino</td> <td>Mac</td> <td></td></tr>
<tr><td>Firefox</td> <td>Windows</td> <td></td></tr>
<tr><td>Firefox</td> <td>Mac</td> <td></td></tr>
<tr><td>Flock</td> <td>Windows</td> <td></td></tr>
<tr class="warning">
<td>IE 7</td> <td>Windows</td> <td>Reads unnecessary attributes for elements, such as &lt;img /&gt;.</td></tr>
<tr><td>IE 7</td> <td>Windows</td> <td>Reads unnecessary attributes for elements, such as &lt;img /&gt;.</td></tr>
<tr><td>IE 6</td> <td>Windows</td> <td></td></tr>
<tr class="warning">
<td>IE 5</td> <td>Windows</td> <td>IE5 does not translate &lt;!--comments--&gt;.</td></tr>
<tr class="warning">
<td>Opera</td> <td>Windows</td> <td>Writes uppercase element tags and attribute names. Writes unnecessary attributes, such as <em>shape="rect"</em>.</td></tr>
<tr><td>IE 5</td> <td>Windows</td> <td>IE5 does not translate &lt;!--comments--&gt;.</td></tr>
<tr><td>Opera</td> <td>Windows</td> <td>Writes uppercase element tags and attribute names. Writes unnecessary attributes, such as <em>shape="rect"</em>.</td></tr>
<tr><td>Safari</td> <td>Mac</td> <td></td></tr>
</tbody>
</table>
Expand Down

0 comments on commit 44f6573

Please sign in to comment.