Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(docs): EDGE could not open the docs #571

Merged
merged 5 commits into from
Dec 7, 2018

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Dec 6, 2018

Removed crossOrigin='true' from the new added script tags in index.ejs, because edge has some issues with those, resulting in - the docs can't be opened in edge. If there is some solid reason why these were added, please let me know. @levithomason @miroslavstastny @kolaps33

@layershifter
Copy link
Member

layershifter commented Dec 6, 2018

We had a similar issue in SUIR repo, Semantic-Org/Semantic-UI-React#3163. I enforced https for scripts: https://github.com/Semantic-Org/Semantic-UI-React/blob/master/docs/src/components/Document.js#L44

It there any reason why we need http on CDN links?

@mnajdova
Copy link
Contributor Author

mnajdova commented Dec 6, 2018

Thanks for the suggestion @layershifter All script/styles resources urls are now https, and I confirmed that it works on Edge.

Copy link
Contributor

@kuzhelov kuzhelov left a comment

Choose a reason for hiding this comment

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

please, ensure that CHANGELOG.md entry will be present before merging. Thank you!

<script
crossOrigin="true"
Copy link
Member

Choose a reason for hiding this comment

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

The crossorigin attribute let's us see errors that are thrown in these scripts. Without it, the error will not be logged in the console and debugging is impossible.

When copied from Semantic UI React's Document.js I failed to change the camel cased crossOrigin to crossorigin. If this is fixed, is Edge happy? We'd like to have these properties still.

@@ -26,27 +26,24 @@
</script>
</head>
<body>
<script src="//cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.1/anchor.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.1/anchor.min.js"></script>
Copy link
Member

@levithomason levithomason Dec 6, 2018

Choose a reason for hiding this comment

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

Why did I normalize all scripts to //?

Scripts without the protocol (http / https) allow the browser to request the script using the current protocol. In dev mode, http, this would allow scripts to be fetched over http which is much faster than https. This is valid HTML per the specifications as you can see here.

Which should we use?

In fact, it seems I needed to update my best practices. You can see more from Paul Irish here. The short answer is https is encouraged for all sources, it is no longer a perf concern, and protocol-less urls are considered an anti-pattern.

Your changes here are correct.

Copy link
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

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

Let's first try fixing the crossorigin casing and testing in Edge before merging. We really want to be able to read errors raised in CDN scripts during development.

@levithomason levithomason added the needs author feedback Author's opinion is asked label Dec 6, 2018
@mnajdova
Copy link
Contributor Author

mnajdova commented Dec 6, 2018

@levithomason Edge is not working with neither of this four combinations:
crossOrigin="true"
crossOrigin="anonymous"
crossorigin="true"
crossorigin="anonymous"
The docs is opened only if this attr is removed. I don't see another alternative at this moment other then removing them, although I understand the benefits we would have from using it. My proposal is, until we find another alternative, to just remove them. Thoughts?

@mnajdova mnajdova removed needs author feedback Author's opinion is asked labels Dec 6, 2018
@miroslavstastny miroslavstastny added needs author feedback Author's opinion is asked and removed ready for merge labels Dec 7, 2018
@miroslavstastny
Copy link
Member

@levithomason - I think the casing with capital O is correct - crossOrigin in ejs file results in crossorigin in html.
That being said, do you have any reference to what crossorigin="true" really does? All the references only talk about anonymous and use-credentials (with a note that "An invalid keyword and an empty string will be handled as the anonymous keyword.").
@mnajdova - If you change the urls to https:// then crossOrigin="true" works in Edge. I think that would be the best solution.

@mnajdova
Copy link
Contributor Author

mnajdova commented Dec 7, 2018

@miroslavstastny that was the only combination I missed yesterday, thanks for pointing that out. Confirmed, it works on edge. Agreed that we should use anonymous as it is one of the valid options: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes

@mnajdova mnajdova merged commit bae9381 into master Dec 7, 2018
@layershifter layershifter deleted the fix/crossorigin-removed-from-scripts-tag branch December 7, 2018 10:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs author feedback Author's opinion is asked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants