With the release of iPhone 6s, iOS9, OS X 10.11 El Capitan, and even watchOS 2, web developers now have the opportunity to try new features in Safari 9 . Further we will analyze them in detail in our article.
CSS
Background Filter Support (backdrop-filter)
This property is definitely in the Filter Effect Level 2 , it allows you to apply filters to the background of the element, and not to its background. You can create a translucent background, for example for a menu on a background image. The text reads well and looks spectacular, as in iOS.
Support for slide carousel using gestures (scroll-snap), written in CSS without using JavaScript. It can be both vertical and horizontal, more details in the W3C specification.
CSS @supports directives will help developers determine whether a user's browser can handle CSS or not. The device browser ignores CSS properties that it does not support. When using more than one property for outdated and modern browsers, they are mixed and difficult to read. For such cases it is convenient to use @supports.
Consider an example with media queries (media query):
Attributes of selectors The “i” attribute was proposed in the CSS2 specification, but was not included in the standard. It is needed to simplify the determination of the path of the file being attached.
: lang Defines the language that is used in the document or its fragment. With this attribute, you can set certain settings that are typical for different languages, for example, the type of quotes in quotes.
: matches Standardization of Firefox: moz-any and WebKit: webkit-any, which for some time was present in the prefixes. Allows the author of the style to combine similar rules.
However, please note that in the new OS X 10.11 (El Capitan) this font is not.
Apple left the concept of "system font" and did not give it an explicit name. Any hidden font names may change and will start with a dot, for example, “.SFNSDisplay-Ultralight”.
Apple developers explain this need by the fact that the OS itself must determine what type of font it uses. As part of this abstraction, a new family appears under the common name: -apple-system.
Javascript
Test results show that, through JavaScript kernel optimization technologies, performance has been improved.
Navigation Timing API
Navigation Timing is a one-stop solution for measuring page load times. It covers the full cycle of interaction with the site - from the moment of the very first user request to full download. The Navigation Timing solution was present in iOS8, was removed in version 8.1, but now it is again implemented in the new version of the browser.
This standard is of particular interest for mobile sites and applications for which the process of measuring performance indicators is difficult to implement. The Navigation Timing API is fully supported by WebKit.
In addition, unlike the popular measurement methods associated with the use of JavaScript, low-level metrics are also available - the time to access DNS servers or the time spent on redirection.
Sensor Events (3D Touch)
3D Touch technology appeared in the iPhone 6s and iPhone 6s Plus and is based on the development of the Force Touch, used in the Apple Watch and the latest MacBook models. 3D Touch expands interaction with the device, giving the user the ability to access application functions without launching them.
Web developers can now access a touch sensitive sensor using JavaScript.
var force = document.getElementById('force'); force.addEventListener("mousedown", function(event) { var forceLevel = event["webkitForce"]; var clickForce = MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN; var forceClickForce = MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN; if (forceLevel >= clickForce && forceLevel < forceClickForce) { console.log("normal click"); } elseif (forceLevel >= forceClickForce) { console.log("force click"); } });
An example of an Xcode 7 simulator.
Picture in Picture
You can use the JavaScript API to add custom controls in picture-in-picture mode for HTML5 videos. It is not supported on iPads released earlier than iPad Air and iPad mini 2. Full functionality is only available on iPad Air 2. In addition, AirPlay also works.
Safari9, like Chrome, supports standards for tracking differences between browser scrollTop.
console.log(document.scrollingElement.scrollTop);
Uploading files to iCloud and supporting third-party services
Prior to iOS8, it supported only photo uploading, but gradually support expanded to iCloud and third-party applications. GoogleDrive, Dropbox and other services are also supported.
CloudKit JS
CloudKit is available in iOS, OSX applications and now on the web using JavaScript. Handbook of CloudKit JS.
ECMAScript 2015
The new version has become available to support ECMAScript 2015 including:
Classes
Computed Properties
WeakSet objects
Numeric objects
Unary and binary literals
Character objects
Literals Templates
Development tools
Adaptive design mode
With it, you can use the full power of new developer tools and test the layout of your sites on all screens. There are both predefined permissions and three free slots for user permissions. Additionally, you can emulate pixel density and change the User Agent string.