Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input type="color" false negative in Opera 11 #159

Closed
edwardgalligan opened this issue Dec 17, 2010 · 9 comments
Closed

input type="color" false negative in Opera 11 #159

edwardgalligan opened this issue Dec 17, 2010 · 9 comments

Comments

@edwardgalligan
Copy link

There's a bug (#CORE-35065) in Opera 11's input type="color" support that makes the smiley test fail.

The smiley test was introduced due to a bug in Chrome I believe (according to this comment anyway); and the original input test used in Modernizr 1.0 works fine in Opera 11. Not sure its possible to work around both Opera and Chrome's feature-detection bugs simultaneously though :(

See @miketaylr's original Modernizr 1.0 based page for reference: http://miketaylr.com/code/input-type-attr.html

@paulirish
Copy link
Member

thx for reporting this here, lucideer.

fearphage also reported this it seems:

Another bug (DSK-321133): accepts any value (unlike date, datetime-local, number, week, month)

@edwardgalligan
Copy link
Author

Fix:

If you force a reflow in between setting the input value and checking the input value, Opera reports correctly. So...

inputElem.value = smile;
docElement.appendChild(inputElem).offsetWidth; // force reflow

... makes it work.

@paulirish
Copy link
Member

Wow. nice hack. :)

thx man!

@edwardgalligan
Copy link
Author

http://miketaylr.com/code/html5-forms-ui-support.html

^ this page was reporting correctly in Opera, so I had a look at figuring out why. Turns out jQuery inadvertently forces a document reflow while it's testing to see if W3C box model is supported, when it loads up - hence the test works there.

@paulirish
Copy link
Member

Demo fiddle: http://jsfiddle.net/paul/SunVF/5/ (it alert()s 4 times. sry)

Opera 11 supports <input type=color> with a colorpicker UI but Modernizr is reporting false.

The main problem is the Opera is very slow to enforce input value constraint validation onto the element. Currently Opera 11 changes it to #000000 but only at the window load event. That is too late for our purposes.

To match the results of the other input values, the value validation would be applied even when the element is not yet added to the DOM.

and miketaylr sez..

so possibly CORE-35065 has been reported as fixed as of 1-10 which looks super related... if so, that means when 11.10 drops it should work

@edwardgalligan
Copy link
Author

The main problem is the Opera is very slow to enforce input value constraint validation onto the element. Currently Opera 11 changes it to #0 but only at the window load event. That is too late for our purposes.

I don't think that's the case. It's nothing to do with timing or the window load event. What you're seeing happening there is, Mootools (I guess - or some script loaded on that jsfiddle page) is triggering a document reflow at the window load event, which causes Opera to correct the value. You can trigger a document reflow as early as you like though - as I mentioned above.

@paulirish
Copy link
Member

Yeah agreed. When I refound this bug, i had forgotten you already provided the fix.
I'll probably land the reflow fix temporarily until Opera 11.10 drops.

thx lucideer

@paulirish
Copy link
Member

inputtypes fixup. Address Opera 11 type=color bug. Visually hide the type=range
Cache the inputElemType for speed.

I hope to remove the extra Opera handling when 11.10 comes out.

Closed by be9c058

paulirish added a commit to SlexAxton/Modernizr that referenced this issue May 26, 2011
…type=range

Cache the inputElemType for speed.

I hope to remove the extra Opera handling when 11.10 comes out.

Fixes Modernizr#159
Fixes Modernizr#160
@ajpiano
Copy link

ajpiano commented Feb 20, 2012

This seems to have been since remedied, perhaps it's time to remove this workaround?

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
…type=range

Cache the inputElemType for speed.

I hope to remove the extra Opera handling when 11.10 comes out.

Fixes Modernizr#159
Fixes Modernizr#160
patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants