react-new-window icon indicating copy to clipboard operation
react-new-window copied to clipboard

do never convert <link> to <style>

Open Prinzhorn opened this issue 7 years ago • 5 comments

I don't expect this to get merged in its current form as it is a breaking change. However, we need a solution (maybe a config?).

Right now a <link> element that is on the same-origin or that is configured with crossorigin is always converted to <style> (because .cssRules can be accessed, which is otherwise prevented by the SOP). This breaks our Content-Security-Policy because it forbids inline styles. This PR fixes this by always injecting a <link> if the source is also a <link>.

However, this breaks current uses that rely on the current behavior to rewrite import and font-face rules in <link> by making the paths absolute.

Thoughts?

Prinzhorn avatar Jun 20 '18 06:06 Prinzhorn

Now that I think about it, is it actually breaking anything? The import/font-face rewrites are needed because inline-styles have about:blank as origin. But <link> stylesheets don't and also accessing href returns a fully qualified URL, so things like /style.css should still work.

Prinzhorn avatar Jun 20 '18 07:06 Prinzhorn

Hey there! I'm catching up with all pending PRs. I think this can be merged?

rmariuzzo avatar Oct 05 '20 15:10 rmariuzzo

Hey there! I'm catching up with all pending PRs. I think this can be merged?

Nice! Go ahead and merge if you want. I haven't used React in a while but I think this PR works and you can always release it with a new major version to be safe.

Prinzhorn avatar Oct 05 '20 15:10 Prinzhorn

Ty

On Mon, Oct 5, 2020, 11:27 Alexander Prinzhorn [email protected] wrote:

Hey there! I'm catching up with all pending PRs. I think this can be merged?

Nice! Go ahead and merge if you want. I haven't used React in a while but I think this PR works and you can always release it with a new major version to be safe.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rmariuzzo/react-new-window/pull/14#issuecomment-703706351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADLMH6OQI5OBGYCU7JVTA3SJHQVPANCNFSM4FF2ZYZQ .

rmariuzzo avatar Oct 06 '20 15:10 rmariuzzo

Note to myself: need to check if current version repro the issue.

rmariuzzo avatar Nov 28 '22 06:11 rmariuzzo