chrisdavies / tiny-date-picker

A small, modern, dependency-free date picker
https://chrisdavies.github.io/tiny-date-picker/
415 stars 88 forks source link

AttachToDom stale in dist #110

Open 13protons opened 5 years ago

13protons commented 5 years ago

The dist folder has an old build which ignores the appendTo parameter. Can you please update and publish so this works as expected from NPM?

From dist https://github.com/chrisdavies/tiny-date-picker/blob/master/dist/tiny-date-picker.js#L674

attachToDom: function () {
    document.body.appendChild(dp.el);
},

From src https://github.com/chrisdavies/tiny-date-picker/blob/master/src/mode/base-mode.js#L32

attachToDom: function () {
    opts.appendTo.appendChild(dp.el);
}
13protons commented 5 years ago

Fun fact - this was discovered while trying to use TDP inside an angular app that had been added to a shadowDom using their ViewEncapsulation.ShadowDom option. The date picker styles are inside the shadow root, but TDP attaches itself to the body and therefore can't pick up and use the styles.

Probably nobody noticed when their custom appendTo element failed because the dropdown would still work on a page without the shadowDom boundary.