jQuery 3.6.3 Released: A Quick Selector Fix

Last week, we released jQuery 3.6.2. There were several changes in that release, but the most important one addressed an issue with some new selectors introduced in most browsers, like :has(). We wanted to release jQuery 3.6.3 quickly because an issue was reported that revealed a problem with our original fix. More details on that below.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.3.

Using CSS.supports the right way

After the issue with :has that was fixed in jQuery 3.6.2, we started using CSS.supports( “selector(SELECTOR)”) to determine whether a selector would be valid if passed directly to querySelectorAll. When CSS.supports returned false, jQuery would then fall back to its own selector engine (Sizzle). Apparently, our implementation had a bug. In CSS.supports( “selector(SELECTOR)”), SELECTOR needed to be a <complex-selector> and not a <complex-selector-list>. For example:

CSS.supports(“selector(div)”); // true
CSS.supports(“selector(div, span)”); // false

This meant that all complex selector lists were passed through Sizzle instead of querySelectorAll. That’s not necessarily a problem in most cases, but it does mean that some level 4 selectors that were supported in browsers but not in Sizzle, like :valid, no longer worked if it was part of a selector list (e.g. “input:valid, div”). It should be noted this currently only affects Firefox, but it will be true in all browsers as they roll out changes to CSS.supports.

This has now been fixed in jQuery 3.6.3 and it is the only functional change in this release.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.6.3.js

https://code.jquery.com/jquery-3.6.3.min.js

You can also get this release from npm:

npm install [email protected]

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.6.3.slim.js

https://code.jquery.com/jquery-3.6.3.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Michal Golebiowski-Owczarek and the whole jQuery team.

Changelog

Full changelog: 3.6.3

Build

remove stale Insight package from custom builds (81d5bd17)
Updating the 3.x-stable version to 3.6.3-pre. (2c5b47c4)

Selector

Update Sizzle from 2.3.8 to 2.3.9 (#5177, 8989500e)

Flatlogic Admin Templates banner

ASP.NET Core updates in .NET 7 Preview 2

.NET 7 Preview 2 is now available and includes many great new improvements to ASP.NET Core.

Here’s a summary of what’s new in this preview release:

Infer API controller action parameters that come from services
Dependency injection for SignalR hub methods
Provide endpoint descriptions and summaries for minimal APIs
Binding arrays and StringValues from headers and query strings in minimal APIs
Customize the cookie consent value

For more details on the ASP.NET Core work planned for .NET 7 see the full ASP.NET Core roadmap for .NET 7 on GitHub.

Get started

To get started with ASP.NET Core in .NET 7 Preview 2, install the .NET 7 SDK.

If you’re on Windows using Visual Studio, we recommend installing the latest Visual Studio 2022 preview. Visual Studio for Mac support for .NET 7 previews isn’t available yet but is coming soon.

To install the latest .NET WebAssembly build tools, run the following command from an elevated command prompt:

dotnet workload install wasm-tools

Upgrade an existing project

To upgrade an existing ASP.NET Core app from .NET 7 Preview 1 to .NET 7 Preview 2:

Update all Microsoft.AspNetCore.* package references to 7.0.0-preview.2.*.
Update all Microsoft.Extensions.* package references to 7.0.0-preview.2.*.

See also the full list of breaking changes in ASP.NET Core for .NET 7.

Infer API controller action parameters that come from services

Parameter binding for API controller actions now binds parameters through dependency injection when the type is configured as a service. This means it’s no longer required to explicitly apply the [FromServices] attribute to a parameter.

Services.AddScoped<SomeCustomType>();

[Route(“[controller]”)]
[ApiController]
public class MyController : ControllerBase
{
// Both actions will bound the SomeCustomType from the DI container
public ActionResult GetWithAttribute([FromServices]SomeCustomType service) => Ok();
public ActionResult Get(SomeCustomType service) => Ok();
}

You can disable the feature by setting DisableImplicitFromServicesParameters:

Services.Configure<ApiBehaviorOptions>(options =>
{
options.DisableImplicitFromServicesParameters = true;
})

Dependency injection for SignalR hub methods

SignalR hub methods now support injecting services through dependency injection (DI).

Services.AddScoped<SomeCustomType>();

public class MyHub : Hub
{
// SomeCustomType comes from DI by default now
public Task Method(string text, SomeCustomType type) => Task.CompletedTask;
}

You can disable the feature by setting DisableImplicitFromServicesParameters:

services.AddSignalR(options =>
{
options.DisableImplicitFromServicesParameters = true;
});

To explicitly mark a parameter to be bound from configured services, use the [FromServices] attribute:

public class MyHub : Hub
{
public Task Method(string arguments, [FromServices] SomeCustomType type);
}

Provide endpoint descriptions and summaries for minimal APIs

Minimal APIs now support annotating operations with descriptions and summaries used for OpenAPI spec generation. You can set these descriptions and summaries for route handlers in your minimal API apps using an extension methods:

app.MapGet(“/hello”, () => …)
.WithDescription(“Sends a request to the backend HelloService to process a greeting request.”);

Or set the description or summary via attributes on the route handler delegate:

app.MapGet(“/hello”, [EndpointSummary(“Sends a Hello request to the backend”)]() => …)

Binding arrays and StringValues from headers and query strings in minimal APIs

With this release, you can now bind values from HTTPS headers and query strings to arrays of primitive types, string arrays, or StringValues:

// Bind query string values to a primitive type array
// GET /tags?q=1&q=2&q=3
app.MapGet(“/tags”, (int[] q) => $”tag1: {q[0]} , tag2: {q[1]}, tag3: {q[2]}”)

// Bind to a string array
// GET /tags?names=john&names=jack&names=jane
app.MapGet(“/tags”, (string[] names) => $”tag1: {names[0]} , tag2: {names[1]}, tag3: {names[2]}”)

// Bind to StringValues
// GET /tags?names=john&names=jack&names=jane
app.MapGet(“/tags”, (StringValues names) => $”tag1: {names[0]} , tag2: {names[1]}, tag3: {names[2]}”)

You can also bind query strings or header values to an array of a complex type as long as the type has TryParse implementation as demonstrated in the example below.

// Bind to aan array of a complex type
// GET /tags?tags=trendy&tags=hot&tags=spicy
app.MapGet(“/tags”, (Tag[] tags) =>
{
return Results.Ok(tags);
});

class Tag
{
public string? TagName { get; init; }

public static bool TryParse(string? tagName, out Tag tag)
{
if (tagName is null)
{
tag = default;
return false;
}

tag = new Tag { TagName = tagName };
return true;
}
}

Customize the cookie consent value

You can now specify the value used to track if the user consented to the cookie use policy using the new CookiePolicyOptions.ConsentCookieValue property.

Thank you @daviddesmet for contributing this improvement!

Request for feedback on shadow copying for IIS

In .NET 6 we added experimental support for shadow copying app assemblies to the ASP.NET Core Module (ANCM) for IIS. When an ASP.NET Core app is running on Windows, the binaries are locked so that they cannot be modified or replaced. You can stop the app by deploying an app offline file, but sometimes doing so is inconvenient or impossible. Shadow copying enables the app assemblies to be updated while the app is running by making a copy of the assemblies.

You can enable shadow copying by customizing the ANCM handler settings in web.config:

<?xml version=”1.0″ encoding=”utf-8″?>
<configuration>
<system.webServer>
<handlers>
<remove name=”aspNetCore”/>
<add name=”aspNetCore” path=”*” verb=”*” modules=”AspNetCoreModuleV2″ resourceType=”Unspecified”/>
</handlers>
<aspNetCore processPath=”%LAUNCHER_PATH%” arguments=”%LAUNCHER_ARGS%” stdoutLogEnabled=”false” stdoutLogFile=”.logsstdout”>
<handlerSettings>
<handlerSetting name=”experimentalEnableShadowCopy” value=”true” />
<handlerSetting name=”shadowCopyDirectory” value=”../ShadowCopyDirectory/” />
</handlerSettings>
</aspNetCore>
</system.webServer>
</configuration>

We’re investigating making shadow copying in IIS a feature of ASP.NET Core in .NET 7, and we’re seeking additional feedback on whether the feature satisfies user requirements. If you deploy ASP.NET Core to IIS, please give shadow copying a try and share with us your feedback on GitHub.

Give feedback

We hope you enjoy this preview release of ASP.NET Core in .NET 7. Let us know what you think about these new improvements by filing issues on GitHub.

Thanks for trying out ASP.NET Core!

The post ASP.NET Core updates in .NET 7 Preview 2 appeared first on .NET Blog.Flatlogic Admin Templates banner

Happy 20th Anniversary, .NET!

Today marks 20 years since Visual Studio .NET launched and the first version of the .NET platform was released (or should I say, unleashed) to the world. We’re celebrating all month long and we encourage you to tune into a special celebration broadcast, tomorrow, February 14, 9:00am Pacific Time on www.dot.net. Share your stories on Twitter with #dotNETLovesMe, show off your memorabilia, and download some digital swag.

A celebration of the .NET community

Today, over five million developers use .NET and this is a celebration of all of you. It’s amazing that a 20-year-old platform has been the most loved framework by developers for three years in a row now – 2019, 2020, 2021, according to Stack Overflow’s developer survey. And CNCF has recognized .NET repositories in the top 30 highest velocity open-source projects on GitHub since 2017, a testament to all the people actively making the platform better every day. Contributions from the community have also had a direct impact on performance, with .NET topping the TechEmpower performance benchmarks for years. There are hundreds of thousands of packages on NuGet built by the community, thousands of components and tools available from .NET ecosystem partners, and hundreds of .NET user groups worldwide helping local communities learn .NET.

The .NET platform would not be where it is today without all of you.

20 years of innovation

Microsoft has always had deep developer roots. It was born from DOS and BASIC, and by the 90’s we had a large developer tools portfolio, with many different tools and languages for building many kinds of applications. Each tool was good at solving different problems. However, applications had difficulty communicating across them, particularly across machine boundaries.

With the rise of the internet, the world saw an easier way to share information. Technology shifted towards distributed systems that communicated over the internet. .NET was built for this internet revolution. Multiple languages, one runtime, and a set of libraries and APIs that were all compatible. .NET was at the forefront of Microsoft’s transformation to embrace the internet age. We even started tagging “.NET” onto many of our product names back then! Who remembers Windows .NET Enterprise Server?

The minute I started playing with .NET I was hooked. From that moment, I dedicated my career to sharing my knowledge and love for .NET. I’ve had the pleasure of working at Microsoft now for almost 15 years and always with .NET. As the years have progressed, I’ve seen .NET constantly innovate. It’s not just the amazing engineers here at Microsoft. The feedback and help from the developer community has been the key to its success.

When Microsoft made another major transformation, this time towards open source, .NET was also at the forefront. By 2012, we had fully open-sourced the ASP.NET MVC web framework and were accepting contributions. It was one of Microsoft’s first major open-source projects at the time. In 2014, we started to build a cross-platform and open-source .NET on GitHub and were floored at the incredible support and contributions from the open-source community. We released the first version at the Red Hat DevNation conference in 2016 and demonstrated it running on Red Hat Enterprise Linux, something that would have been unheard of in the early days. .NET is not just for Windows. We’ve built strong partnerships with companies like Red Hat and IBM to bring .NET to RHEL, IBM Z and IBM LinuxONE. We also have relationships with other distributions, both commercial and community led.

What’s next?

We just released .NET 6 in November 2021 and are full speed ahead building .NET 7. In fact, .NET 7 Preview 1 will release this week. With .NET 6 you now have a unified set of base libraries and SDK, a simplified development experience with investments in C# 10 and minimal APIs, high productivity with hot reload, and a whole lot more. .NET 6 is the fasted adopted version of .NET yet, and we’re seeing very good reception from users. I encourage you to give it a try if you haven’t already.

We’re excited to get the .NET Multi-platform App UI (.NET MAUI) release out the door and in your hands very soon. .NET MAUI will let you build native apps for Windows, macOS, iOS and Android with a single codebase and we are now focusing on quality and bugs so now is the time to try the preview and give us feedback while we can act on it.

With every release we see more growth in .NET usage, and it continues to attract increasing numbers of new, diverse developers. As a long-time member of the .NET community, this is what excites me the most.

.NET has come a long way in 20 years but the original vision to change developers’ lives still holds true. You can build any type of app, for any operating system, with great performance. From high-throughput, cloud-scale services to the smallest microcontrollers .NET is there, and the community has made this platform and its large ecosystem a huge success. Thank you!

We hope you will join us and tune into the celebration broadcast tomorrow, February 14, 9:00am Pacific Time on www.dot.net. Join Scott Hunter, Scott Hanselman, and special guests sharing their stories and taking us on a journey of .NET’s past, present and future. There are also many other events and celebrations happening in the community from our partners, MVPs, and others so be sure to check #dotNETLovesMe on Twitter for all the info.

Here’s to another 20 years!

The post Happy 20th Anniversary, .NET! appeared first on .NET Blog.Flatlogic Admin Templates banner