Write a JavaScript function that locates all code snippets within a web page, specifically those contained within a pre element. For each code snippet, identify all span elements within it. Finally, modify each span element by assigning it a randomly generated text color. Additionally, ensure that the function does not modify any span elements that are nested within other elements, only the ones directly contained within the code snippet.
user
{"source": "argilla/distilabel-evol-prompt-collective", "kind": "synthetic", "evolved_from": "Write a JavaScript function that locates all code snippets within a web page, specifically those contained within a pre element. For each code snippet, identify all span elements within it. Finally, modify each span element by assigning it a randomly generated text color."}
Write a JavaScript function that locates all code snippets within a web page, specifically those contained within a pre element. For each code snippet, identify all span elements within it. Finally, modify each span element by assigning it a randomly generated text color. Additionally, ensure that the function does not modify any span elements that are nested within other elements, only the ones directly contained within the code snippet.
user
DUMMY RESPONSE
assistant