Like many folks I learned JavaScript by learning jQuery.
Lately I have been replacing bits like:
$(this).attr('title')
with this.title
$(this).attr('id')
with this.id
$(this).val()
with this.value
$(this).parent()
with this.parentNode
$(this).attr('class')
with this.className
Not only is my code cleaner but technically faster.
Is this type of reduction acceptable and encouraged?
Are there any other common practices I should be doing in
rawplain JavaScript instead of jQuery?Are there any potential cross browser issues with this type of reduction-ism?