Replace text() with a check for the text property for speed and compatibility