simonwep / pickr

🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!
https://simonwep.github.io/pickr
MIT License
4.29k stars 287 forks source link

`el` is forcibly replaced with a `div` Element #289

Closed zepumph closed 3 years ago

zepumph commented 3 years ago

What is the current behavior?

When I pass in an element that is a span for the button to be added to, creating a pickr swaps that out for a div with no explanation.

Please provide the steps to reproduce and create a JSFiddle.

Take the above fiddle, and swap the div.pickr for a span

What is the expected behavior?

When I pass in a span as the el option, it should stay a span

Your environment:

Version (see Pickr.version): 1.8,1
Used bundle (es5 or normal one): both, but mostly the es5
Used theme (default is classic):  classic
Browser-version:   Version 91.0.4472.124 (Official Build) (64-bit)
Operating-system:   Window 10 version 10.0.19041 Build 19041

Thanks for taking a look!

simonwep commented 3 years ago

The options say:

    // Don't replace 'el' Element with the pickr-button, instead use 'el' as a button.
    // If true, appendToBody will also be automatically true.
    useAsButton: false,

And since false is the default value it'll be replaced. The el property without useAsButton: true is merely an anchor point for where pickr should be mounted :)

zepumph commented 3 years ago

I see thanks. Thanks. That is helpful. Closing