freqdec / fd-slider

An Unobtrusive Accessible Slider script that can also be used as an HTML5 Input Range polyfill solution
Other
264 stars 55 forks source link

Precise input type=range check #40

Closed acdha closed 11 years ago

acdha commented 11 years ago

This avoids clobbering <input type="number"> controls which also have min/max/step attributes.

Tested as far back as IE8

freqdec commented 11 years ago

Hi Chris,

Are you sure this returns a "range" value across browsers? I thought a delve into outerHTML was necessary in order to catch the type="range" across browsers... let's hope I'm wrong

acdha commented 11 years ago

@freqdec I wasn't certain either but based on what I've read it appears that getAttribute has consistently meant “As authored” for a long time.

I tossed together a simple test:

http://jsbin.com/enoqen/2/

This works as far back as IE6:

http://www.webpagetest.org/result/130319_5X_PT3/1/screen_shot/

Here's another set of results in Chrome, Firefox, etc.: http://websitetest.com/ui/tests/5148676c8b5f0253c5000017

freqdec commented 11 years ago

I do believe Sir that I owe you a few pints of Guinness. Very much appreciated.

acdha commented 11 years ago

Thanks - that can partially defray the pints I owe you for releasing this ;)

Anthony-Mckale commented 11 years ago

Hi having issues with this commit in firefox 19 + windows 7

throwing a type error on the "inp.getAttribute("type")" for inputs which don't have explicit type attributes set

think

inp.getAttribute("type").toLowerCase() == "range"

needs changed to

( inp.getAttribute("type") && inp.getAttribute("type").toLowerCase() == "range")

cheers

Ant

Anthony-Mckale commented 11 years ago

correction

-> (getAttribute(inp,"type") && getAttribute(inp,"type").toLowerCase() == "range")

freqdec commented 11 years ago

Hi Anthony, I've just integrated your fix into the code. Many thanks indeed!

Anthony-Mckale commented 11 years ago

no probs, ps great wee shim