jQuery Speed Test: $(this).attr(“id”); vs this.id

Leading on from Speed Test $(this) vs .get() vs .eq() I decided to do a quick test to compare the speed of $(this).attr(“id”); vs this.id which can be used on native attributes such as id, src, href, style etc… but not on properties such as bgcolor, data, etc…

Background

Within context this changes but generally:

$(this) is a jQuery Object which has access to all the jQuery API
this is a reference to the DOM element