jquery / jqueryui.com

jQuery UI web site content
https://jqueryui.com
Other
132 stars 114 forks source link

jQuery UI Css Link incorrect in the view source example code #205

Closed WarriorofZarona closed 3 months ago

WarriorofZarona commented 11 months ago

Currently the code is like so:

<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">

It is missing https: so it is screwing up with anyone trying to copy and paste the code, the resource isn't loading properly.

dmethvin commented 11 months ago

When the protocol is missing, it should take the protocol of whatever page it's used in. Do you have a link to a page where it isn't working? What does devtools show you on the network panel?

WarriorofZarona commented 11 months ago

It's just part of the view source example code. Note that this is the only place where it is missing, the cdn's for the other links and scripts are written correctly.

In draggable:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Draggable - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #draggable { width: 150px; height: 150px; padding: 0.5em; }
  </style>
  <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
  <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#draggable" ).draggable();
  } );
  </script>
</head>
<body>

<div id="draggable" class="ui-widget-content">
  <p>Drag me around</p>
</div>

</body>
</html>
markvantilburg commented 11 months ago

If you open the file locally it will put file:// there and as such will not load the css file.

dmethvin commented 11 months ago

Where is the "view source example code"? Do you have a link to it? There are a lot of pages and I'm still not sure which page it is based on the description above.

mgol commented 11 months ago

I think it's about the demos. E.g. the page https://jqueryui.com/draggable/ loads the URL https://jqueryui.com/resources/demos/draggable/default.html in an iframe and that one uses protocol-relative URLs as mentioned above.

While those URLs are valid, in 2023 it makes sense to just use HTTPS everywhere.

I'm not sure where exactly this is defined, though.

mgol commented 11 months ago

It looks like it may be defined here: https://github.com/jquery/jqueryui.com/blob/1d194396b8176cf8ad33e73b9b21eb1954b75a53/Gruntfile.js#L221-L223. PRs welcome.

mgol commented 11 months ago

I transferred the issue to the correct repository.

mgol commented 3 months ago

This was fixed in https://github.com/jquery/jqueryui.com/commit/7945c962eeb513a0dd28506bf2f48a3f28a7cd4f. Also, see a duplicate issue here: https://github.com/jquery/jquery-ui/issues/2183