Lightning Components winter 19 Highlights

In this post, I am going to quickly recall on the winter 19 Salesforce lightning component changes and improvements.

1.Org Setting for Stricter Content Security Policy 

Winter 19 changed the critical update to an org setting to give you greater control over its enablement. This setting enables Stricter Content Security Policy (CSP), which prohibits the use of unsafe-inline for script-src to mitigate the risk of cross-site scripting attacks. In the previous release, stricter CSP was controlled by the “Enable Stricter Content Security Policy for Lightning Components” critical update. To enable stricter CSP:
1. From Setup, enter Session in the Quick Find box, and then select Session Settings.
2. Deselect Enable Stricter Content Security Policy.
3. Click Save.

2.Freeze JavaScript Prototypes for Improved Security and Stability

In JavaScript, each object has a prototype object. An object inherits methods and properties from its prototype object. Prototypes are shared between all objects of the same type. If a component author modifies a JavaScript prototype of a shared object, it can introduce unexpected behavior and potential security issues. Freezing JavaScript prototypes prevents Lightning component authors from modifying
JavaScript prototypes of global objects that are shared between namespaces. This restriction enables better code separation between components and prevents malicious or inadvertent tampering of shared objects, such as the JavaScript APIs or DOM APIs. To freeze JavaScript prototypes, from Setup, enter Session in the
Quick Find box, and then select Session Settings. Select Freeze JavaScript Prototypes and click Save

before enabling you can see entire prototype objects and methods in the console as shown below.

after enable, you can able to see all the prototype methods are disabled.

3: Enable CDN to Load Lightning Experience Faster

Load Lightning Experience and other apps faster by enabling Akamai’s content delivery network (CDN) to serve the static content for Lightning Component framework. A CDN generally speeds up page load time, but it also changes the source domain that serves the files. If your company has IP range restrictions for content served from Salesforce, test thoroughly before enabling this setting.To enable CDN, from Setup, enter Session in the Quick Find box, and then select Session Settings. Select Enable Content Delivery Network (CDN) for Lightning Component framework, and click Save.

this is not like normal open source CDN 

4. lightning:empApi

Embed the lightning:empApi component in your custom Lightning component to subscribe to a streaming event channel and receive event notifications. You can subscribe to any type of event channel on the Lightning Platform, including channels for platform events, PushTopic, and generic events, and Change Data Capture (Developer Preview) events. The lightning:empApi the component uses a shared CometD-based Streaming API connection, enabling you to run multiple streaming apps in the browser.

5. lightning:map

The lightning:map component securely displays a map of one or more locations using Google Maps. You can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street. Here’s the map component with one address. When you specify multiple locations, the map component creates clickable tiles for each location. You can specify a title to display
above the list of addresses. You can also show a footer with an “Open in Google Maps” link and specify an initial zoom level for the map.

6. lightning:menuDivider

This component is used as a child component of lightning:buttonMenu. Use lightning:menuDivider to create a dividing line after a menu item. By default, space is added above and below the divider. Use variant=”compact” with
lightning:menuDivider to reduce the space.

7. lightning:menuSubheader

This component is used as a child component of lightning:buttonMenu. Use lightning:menuSubheader to create subheadings in the list of menu items. Specify the text of the heading using the label attribute.

8. lightning:accordion Multi Select Options 

Now with this new allowMultipleSectionsOpen attribute, you can able to open multiple sections of the accordion at the same time. By default, only one accordion section is expanded at a time and onsectiontoggle Specifies a handler for the event that’s fired when the open sections change. The event passes an
array of all open sections in the accordion.

9. lightning:formattedRichText disable HTML links 

With the new disableLinkify attribute now you able to disable the links on formattedRichText. this attribute prevents the component from creating links automatically for linkable text in the formatted output

            <lightning:formattedRichText disableLinkify="true" value="This is a link to &lt;a href=&quot;;&gt;Salesforce&lt;/a&gt;"></lightning:formattedRichText>

10. lightning:inputField geolocation support 

The lightning:inputField component now supports the geolocation field type. It displays input fields for entering latitude and longitude in decimal degrees.