jqueryui.com icon indicating copy to clipboard operation
jqueryui.com copied to clipboard

jQuery UI Css Link incorrect in the view source example code

Open WarriorofZarona opened this issue 2 years ago • 7 comments

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.

WarriorofZarona avatar Dec 12 '23 00:12 WarriorofZarona

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?

dmethvin avatar Dec 12 '23 22:12 dmethvin

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>

WarriorofZarona avatar Dec 15 '23 00:12 WarriorofZarona

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

markvantilburg avatar Dec 15 '23 07:12 markvantilburg

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.

dmethvin avatar Dec 15 '23 22:12 dmethvin

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 avatar Dec 18 '23 17:12 mgol

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

mgol avatar Dec 18 '23 17:12 mgol

I transferred the issue to the correct repository.

mgol avatar Dec 20 '23 17:12 mgol

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

mgol avatar Jul 26 '24 19:07 mgol