fix #96

Browser compatibiliy problem with attributes.dy (Firefox 25.0 among others)

Check if attribute exists before setting it.