Chrome 35 Beta: More developer control over touch input, new JavaScript features, and unprefixed Shadow DOM

Thursday, April 10, 2014

Today’s Chrome Beta channel release includes a slew of new developer features to help you make richer, more compelling web content and apps, especially for mobile devices. Unless otherwise noted, changes described below apply to Chrome for Android, Windows, Mac, Linux, and Chrome OS.

More developer control over touch and zoom input

The touch-action CSS property offers developers a declarative mechanism to selectively disable touch scrolling, pinch-zooming, or double-tap-zooming on parts of their web content. Use cases include precise control over the dreaded 300ms click delay on mobile, reliable side-swipe UIs, and high-fidelity polyfills of Pointer Events. It’s also a prerequisite for future optimizations to enable scrolling and zooming that never block on the main thread. Update May 20th: touch-action has been delayed until Chrome 36.

Also new in this release, web content on desktop computers will now receive mouse scroll wheel events with the ctrlKey modifier set. There are many sites that want to do something more appropriate for the user than trigger browser zoom. For example, when a user holds control and scrolls over a map in Google Maps, they almost certainly want to zoom in on the map, not invoke browser zoom to zoom the page. This change will enable such a use case.

New JavaScript functionality

Chrome 35 includes support for a number of new JavaScript features defined in the ECMAScript 6 standard. Together, they will help JavaScript developers write application logic that is easier to read, more powerful, and more memory efficient.

A Promise represents a value that may not be available yet but will be known at some point in future. With Promises, you can write cleaner asynchronous code. WeakMaps and WeakSets allow you to create efficient, garbage-collected data structures. In both, references to objects are held weakly: if there is no other reference to an object stored in the WeakSet, it can be garbage collected. This helps avoid memory leaks.

Object.observe lets you observe changes to JavaScript objects. Your callback can observe multiple objects and will receive all changes to any objects in a single asynchronous call. This is especially useful for framework authors implementing data-binding.

Update April 29th: Object.observe has been pushed back to Chrome 36.

Unprefixed Shadow DOM

Shadow DOM is one of several new API primitives landing under the Web Components umbrella. It brings reliable composition of user interface elements to the web platform and allow developers to:

  1. Scope their HTML markup, CSS, hiding the implementation details of complex components.
  2. Build their own first-class elements and APIs just like the <video> or <audio>, when combined with Custom Elements
With Shadow DOM, web frameworks can stop worrying about their widgets inadvertently breaking pages by using conflicting CSS selectors, class or id names, and start relying on DOM as the interoperable way of building components.

Numerous improvements and changes have been made to the specification since the days of the prefixed implementation of Shadow DOM made available in Chrome 25, so if you were already using the prefixed Shadow DOM API please take a look at the latest documentation as well as the up-to-date HTML5 Rocks articles and look for deprecation warnings.

Other new features in this release
  • CSS Font Loading can be used to dynamically load font resources. It gives developers more control over the user experience on pages that use Web Fonts. For instance, you can ask Chrome to start downloading the web fonts you'll need on demand and be notified when they become available.
  • The SVG 'paint-order' property offers a way to control the order in which fill, stroke and markers are painted.
  • The unprefixed version of the Web Audio API.
Removed features

Web platform feature deprecation and removal are important for the health of the web. Removing features allows browser vendors like Chromium to simplify our codebases, minimize security attack surfaces, and, most importantly, evolve the web API surface to address the needs of today’s users and developers.

Features removed in this release include HTMLVideoElement-specific prefixed fullscreen API, TextTrackCue constructor, <isindex>, Legacy Web Notifications, document.createAttributeNS, support for NPAPI on Linux, and Attr.isId, ownerElement, prefix setter. If you’d like to hear more about these changes or participant in discussions, please chime in our mailing list and look for "Intent to Remove" or “Intent to Deprecate” threads.

Recently deprecated features

The most prominent recently deprecated feature is window.showModalDialog, which will be removed in our next release, Chrome 36. Please read Opera’s explanation of the change to learn more. Other deprecated features include Element.setAttributeNodeNS, overflowchanged Event, HTMLSourceElement.media, MediaError.MEDIA_ERR_ENCRYPTED, Prefixed media source extensions, and webkitRequestAnimationFrame. Support for these features will be completely removed from Chrome in a future release.

As always, visit chromestatus.com/features for a complete overview of Chrome’s developer features, and circle +Google Chrome Developers for more frequent updates!

Posted by Rick Byers, Software Engineer and Touch API Tamer

Post a Comment