docs section for non-dom attributes
Also added documentation for `dangerouslySetInnerHTML`.
Cheng Lou committed
Dec 18, 2013 at 00:31 UTC
be177712703c2ccef752230f460fffba2e9ed1bd
4 files changed
+19
-1
docs/_data/nav_docs.yml
+2
@@ -55,3 +55,5 @@
55
title: Event System
56
- id: dom-differences
57
title: DOM Differences
58
+ - id: special-non-dom-attributes
59
+ title: Special Non-DOM attributes
docs/docs/ref-04-tags-and-attributes.md
+3
-1
@@ -57,7 +57,9 @@ rowSpan scrollLeft scrollTop selected size spellCheck src step style tabIndex
57
target title type value width wmode
58
```
59
60
-In addition, the non-standard `autoCapitalize` attribute is supported for Mobile Safari.
60
+The non-standard `autoCapitalize` attribute is supported for Mobile Safari.
61
+
62
+In addition, there is the React-specific attribute `dangerouslySetInnerHTML` ([more here](/react/docs/special-non-dom-attributes.html)), used for directly inserting DOM strings into a component.
63
64
### SVG Attributes
65
docs/docs/ref-06-dom-differences.md
+1
@@ -4,6 +4,7 @@ title: DOM Differences
4
layout: docs
5
permalink: dom-differences.html
6
prev: events.html
7
+next: special-non-dom-attributes.html
8
---
9
10
React has implemented a browser-independent events and DOM system for performance and cross-browser compatibility reasons. We took the opportunity to clean up a few rough edges in browser DOM implementations.
docs/docs/ref-07-special-non-dom-attributes.md
new
+13
@@ -0,0 +1,13 @@
1
+---
2
+id: special-non-dom-attributes
3
+title: Special Non-DOM Attributes
4
+layout: docs
5
+permalink: special-non-dom-attributes.html
6
+prev: dom-differences.html
7
+---
8
+
9
+Beside [DOM differences](/react/docs/dom-differences.html), React offers some attributes that simply don't exist in DOM.
10
+
11
+- `key`: an optional, unique identifier. When your component shuffles around during `render` passes, it might be destroyed and recreated due to the diff algorithm. Assigning it a key that persists makes sure the component stays. See more [here](/react/docs/multiple-components.html#dynamic-children).
12
+- `ref`: see [here](/react/docs/more-about-refs.html).
13
+- `dangerouslySetInnerHTML`: takes an object with the key `__html` and a DOM string as value. This is mainly for cooperating with DOM string manipulation libraries. Refer to the last example on the front page.