Getting an elements attribute RIGHT
I'm developing a plugin that tries to simulate validation of HTML5 form fields (number, email, color, etc...) in browsers that still don't support them, including Firefox, but I have a problem getting an element's real attributes.
Say you have something like this (notice type=email):
<input type='email' />
Firefox doesn't recognize this type yet, but it renders it as a type=text which is alright.
Now, in Firebug you type something like this:
elem = $('[type=email]') // [input]
It works as expected and now elem is your email field. But now you test it's type and this is what you get.
elem.is('[type=email]') // false
elem.attr('type') // "text"
elem[0].type // "text"
Do you guys know any workaround for this? BTW, I'm already using Modernizr, but it doesn't seem to do anything for this.