开发者

Embedd third party js libraries on a custom control library. Yes or not?

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 si开发者_开发技巧nce, 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:

  1. What happens when, as you say, the 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?
  2. Suppose a security 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'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜