You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Remove nested for loop
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -113,16 +113,12 @@ 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++) {
|
setTimeout(() => {
|
||||||
// Do this asynchronously: parsing code takes time and we don't
|
if (this._unmounted) return;
|
||||||
// need to block the DOM update on it.
|
for (let i = 0; i < codes.length; i++) {
|
||||||
setTimeout(() => {
|
this._highlightCode(codes[i]);
|
||||||
if (this._unmounted) return;
|
}
|
||||||
for (let i = 0; i < pres.length; i++) {
|
}, 10);
|
||||||
this._highlightCode(codes[i]);
|
|
||||||
}
|
|
||||||
}, 10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user