Allow and ignore text nodes in gradient element

getAttribute was throwing an error on text nodes contained in a
lineargradient element. This ensures they are elements first.