Skip to content

docs dangerouslySetInnerHTML #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/docs/ref-04-tags-and-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ rowSpan scrollLeft scrollTop selected size spellCheck src step style tabIndex
target title type value width wmode
```

In addition, the non-standard `autoCapitalize` attribute is supported for Mobile Safari.
The non-standard `autoCapitalize` attribute is supported for Mobile Safari.

In addition, there is the React-specific attribute `dangerouslySetInnerHTML` (refer to the last example on the front page), used for directly inserting DOM strings into a component.

### SVG Attributes

Expand Down
1 change: 1 addition & 0 deletions docs/docs/ref-06-dom-differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ prev: events.html
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.

* All DOM properties and attributes (including event handlers) should be camelCased to be consistent with standard JavaScript style. We intentionally break with the spec here since the spec is inconsistent. **However**, `data-*` and `aria-*` attributes [conform to the specs](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#data-*) and should be lower-cased only.
* There is the `dangerouslySetInnerHTML` component attribute, which takes an object with the key `__html` and a DOM string as value. This is mainly for cooperating with libraries that do DOM string manipulations. Refer to the last example on the front page.
* The `style` attribute accepts a JavaScript object with camelCased properties rather than a CSS string. This is consistent with the DOM `style` JavaScript property, is more efficient, and prevents XSS security holes.
* All event objects conform to the W3C spec, and all events (including submit) bubble correctly per the W3C spec. See [Event System](events.html) for more details.
* The `onChange` event behaves as you would expect it to: whenever a form field is changed this event is fired rather than inconsistently on blur. We intentionally break from existing browser behavior because `onChange` is a misnomer for its behavior and React relies on this event to react to user input in real time. See [Forms](forms.html) for more details.