Allow and ignore text nodes in gradient element (fixed)

getAttribute was throwing an error on text nodes contained in a
lineargradient element. This ensures they are elements first. First
commit was checking for type to be a string.