Remove nested for loop
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
4a7bc74e99
commit
b97d8979c7
|
@ -113,19 +113,15 @@ export default class TextualBody extends React.Component {
|
||||||
// Highlight code
|
// Highlight code
|
||||||
const codes = ReactDOM.findDOMNode(this).getElementsByTagName("code");
|
const codes = ReactDOM.findDOMNode(this).getElementsByTagName("code");
|
||||||
if (codes.length > 0) {
|
if (codes.length > 0) {
|
||||||
for (let i = 0; i < codes.length; i++) {
|
|
||||||
// Do this asynchronously: parsing code takes time and we don't
|
|
||||||
// need to block the DOM update on it.
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this._unmounted) return;
|
if (this._unmounted) return;
|
||||||
for (let i = 0; i < pres.length; i++) {
|
for (let i = 0; i < codes.length; i++) {
|
||||||
this._highlightCode(codes[i]);
|
this._highlightCode(codes[i]);
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_addCodeExpansionButton(div, pre) {
|
_addCodeExpansionButton(div, pre) {
|
||||||
// Calculate how many percent does the pre element take up.
|
// Calculate how many percent does the pre element take up.
|
||||||
|
|
Loading…
Reference in New Issue