Swap P tag for span in text() function. Closes #1639