I wonder what’s the best approach for using third party js libraries on a control library.
If the library uses (let’s say) jquery and jquery-ui seems wrong to me to include those on the control library since, if the page using the controls already reference them, they will downloaded twice (the embedded version and the non-embedded version).
On the other side, seems wrong to me to not include them and see how everything fails because the libraries are not referenced.
I could very explicitly specify which js libraries must be referenced for using the controls but not sure if this is the correct approach.
What do you suggest in this case?
I think my concerns with having them embedded in the library would be:
page already references jQuery? What if the page
is referencing a different version
of jQuery to the one you’ve
embedded? Which jQuery instance gets used when
some script runs?
exploit is discovered in the library
you’ve shipped – what then? Would
you need to ship a new version of
your control?
I think it would be better for you to say up-front ‘this control requires version x of jQuery and version y of jQuery-UI’.