mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
1.4 KiB
1.4 KiB
id, title, layout, permalink, prev, next
| id | title | layout | permalink | prev | next |
|---|---|---|---|---|---|
| dom-differences | DOM Differences | docs | dom-differences.html | events.html | special-non-dom-attributes.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.
- The
styleattribute accepts a JavaScript object with camelCased properties rather than a CSS string. This is consistent with the DOMstyleJavaScript 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 for more details.
- The
onChangeevent 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 becauseonChangeis a misnomer for its behavior and React relies on this event to react to user input in real time. See Forms for more details. - Form input attributes such as
valueandchecked, as well astextarea. More here.