bgrins / spectrum

The No Hassle JavaScript Colorpicker
https://bgrins.github.io/spectrum/
MIT License
2.32k stars 588 forks source link

polyfill not working when dom element created after load #418

Closed BHare1985 closed 8 years ago

BHare1985 commented 8 years ago

polyfill works fine if input exists in the DOM to begin with, but dynamically creating an input it doesn't work for IE. Any chance of having a listener that will auto apply when a jquery filter exists, similar to jquery's on body, element

bgrins commented 8 years ago

You could call $.fn.spectrum.processNativeColorInputs (or copy it's implementation) into your page whenever a new input is added. You could detect new elements with a MutationObserver if you wanted a generic way, or if you know where the inputs are being created, you could init spectrum in that function.