Skip to content

Conversation

@eerikson
Copy link
Contributor

@eerikson eerikson commented Apr 5, 2018

Need this feature to allow optional crossOrigin on behance. However, might be nice for any user of this package to define arbitrary properties on <script />.

var el
el = doc.createElement(tag)
firstScript = doc.getElementsByTagName(tag)[0]
if (attrs) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placement is important here—we want to control & possibly overwrite async, src, onload, etc

Copy link

@mmase mmase Apr 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you make attrs = {} by default and then just simply (with no conditional):

Object.assign(el, attrs);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep in mind that we're not using babel here, so let's keep compatibility to IE11.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carry on!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah im trying to keep it old school in this PR.

return new Promise(function (resolve, reject) {
el = doc.createElement(tag)
firstScript = doc.getElementsByTagName(tag)[0]
if (attrs) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto for above

@eerikson eerikson force-pushed the AllowArbitraryPropsOnScriptEl branch from f4ba9fb to 2556a05 Compare April 5, 2018 15:38
Copy link
Owner

@nemtsov nemtsov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@eerikson eerikson merged commit f0a9d4c into nemtsov:master Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants