avoid passing in dom elements to JSON.stringify to prevent errors close #1063