diff --git a/blog/2016/04/07/react-v15.html b/blog/2016/04/07/react-v15.html index 5261fada8b..a1edb21863 100644 --- a/blog/2016/04/07/react-v15.html +++ b/blog/2016/04/07/react-v15.html @@ -168,6 +168,8 @@ Minified build for production: h
  • document.createElement is in and data-reactid is out #

    There were a number of large changes to our interactions with the DOM. One of the most noticeable changes is that we no longer set the data-reactid attribute for each DOM node. While this will make it more difficult to know if a website is using React, the advantage is that the DOM is much more lightweight. This change was made possible by us switching to use document.createElement on initial render. Previously we would generate a large string of HTML and then set node.innerHTML. At the time, this was decided to be faster than using document.createElement for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using createElement we can make other parts of React faster. The ids were used to map back from events to the original React component, meaning we had to do a bunch of work on every event, even though we cached this data heavily. As we’ve all experienced, caching and in particularly invalidating caches, can be error prone and we saw many hard to reproduce issues over the years as a result. Now we can build up a direct mapping at render time since we already have a handle on the node.

    +

    Note: data-reactid is still present for server-rendered content, however it is much smaller than before and is simply an auto-incrementing counter.

    +

    @spicyj in #5205

  • No more extra <span>s #

    Another big change with our DOM interaction is how we render text blocks. Previously you may have noticed that React rendered a lot of extra <span>s. For example, in our most basic example on the home page we render <div>Hello {this.props.name}</div>, resulting in markup that contained 2 <span>s. Now we’ll render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. Very few people have depended on the actual markup generated here so it’s likely you are not impacted. However if you were targeting these <span>s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components.

    diff --git a/blog/index.html b/blog/index.html index 0a2895075b..74b623ee45 100644 --- a/blog/index.html +++ b/blog/index.html @@ -170,6 +170,8 @@ Minified build for production: h
  • document.createElement is in and data-reactid is out #

    There were a number of large changes to our interactions with the DOM. One of the most noticeable changes is that we no longer set the data-reactid attribute for each DOM node. While this will make it more difficult to know if a website is using React, the advantage is that the DOM is much more lightweight. This change was made possible by us switching to use document.createElement on initial render. Previously we would generate a large string of HTML and then set node.innerHTML. At the time, this was decided to be faster than using document.createElement for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using createElement we can make other parts of React faster. The ids were used to map back from events to the original React component, meaning we had to do a bunch of work on every event, even though we cached this data heavily. As we’ve all experienced, caching and in particularly invalidating caches, can be error prone and we saw many hard to reproduce issues over the years as a result. Now we can build up a direct mapping at render time since we already have a handle on the node.

    +

    Note: data-reactid is still present for server-rendered content, however it is much smaller than before and is simply an auto-incrementing counter.

    +

    @spicyj in #5205

  • No more extra <span>s #

    Another big change with our DOM interaction is how we render text blocks. Previously you may have noticed that React rendered a lot of extra <span>s. For example, in our most basic example on the home page we render <div>Hello {this.props.name}</div>, resulting in markup that contained 2 <span>s. Now we’ll render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. Very few people have depended on the actual markup generated here so it’s likely you are not impacted. However if you were targeting these <span>s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components.

    diff --git a/downloads/react-0.14.8.zip b/downloads/react-0.14.8.zip new file mode 100644 index 0000000000..2e8e57d187 Binary files /dev/null and b/downloads/react-0.14.8.zip differ diff --git a/feed.xml b/feed.xml index 8ea50e4570..8dddbb0e99 100644 --- a/feed.xml +++ b/feed.xml @@ -56,6 +56,8 @@ Minified build for production: <a href="https://fb.me/react-dom-15.0.0.m <li><h4><a class="anchor" name="document.createelement-is-in-and-data-reactid-is-out"></a><code>document.createElement</code> is in and <code>data-reactid</code> is out <a class="hash-link" href="#document.createelement-is-in-and-data-reactid-is-out">#</a></h4> <p>There were a number of large changes to our interactions with the DOM. One of the most noticeable changes is that we no longer set the <code>data-reactid</code> attribute for each DOM node. While this will make it more difficult to know if a website is using React, the advantage is that the DOM is much more lightweight. This change was made possible by us switching to use <code>document.createElement</code> on initial render. Previously we would generate a large string of HTML and then set <code>node.innerHTML</code>. At the time, this was decided to be faster than using <code>document.createElement</code> for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using <code>createElement</code> we can make other parts of React faster. The ids were used to map back from events to the original React component, meaning we had to do a bunch of work on every event, even though we cached this data heavily. As we’ve all experienced, caching and in particularly invalidating caches, can be error prone and we saw many hard to reproduce issues over the years as a result. Now we can build up a direct mapping at render time since we already have a handle on the node. </p> +<p><strong>Note:</strong> <code>data-reactid</code> is still present for server-rendered content, however it is much smaller than before and is simply an auto-incrementing counter. </p> + <p><small><a href="https://github.com/spicyj">@spicyj</a> in <a href="https://github.com/facebook/react/pull/5205">#5205</a></small></p></li> <li><h4><a class="anchor" name="no-more-extra-ltspangts"></a>No more extra <code>&lt;span&gt;</code>s <a class="hash-link" href="#no-more-extra-ltspangts">#</a></h4> <p>Another big change with our DOM interaction is how we render text blocks. Previously you may have noticed that React rendered a lot of extra <code>&lt;span&gt;</code>s. For example, in our most basic example on the home page we render <code>&lt;div&gt;Hello {this.props.name}&lt;/div&gt;</code>, resulting in markup that contained 2 <code>&lt;span&gt;</code>s. Now we’ll render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. Very few people have depended on the actual markup generated here so it’s likely you are not impacted. However if you were targeting these <code>&lt;span&gt;</code>s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components. </p>