Upgrade to Pro — share decks privately, control downloads, hide ads and more …

When in doubt, trust the browser

pieterbeulque
December 12, 2019

When in doubt, trust the browser

Presented at Fronteers, Dec 12 2019 at De Kien, Kortrijk.

As a front-end developer, you're always confronted with making choices. In this talk I cover the benefits you get for free when considering W3C standards or standard browser API's instead of reaching for the latest framework or library.

This was a test run of a more theoretical talk I want to base on this. Any feedback is very much appreciated.

pieterbeulque

December 12, 2019
Tweet

More Decks by pieterbeulque

Other Decks in Programming

Transcript

  1. Custom Elements Create your own <html-elements> Progressive enhancement dream Initializes

    whenever a node is added to the DOM Anything is possible!
  2. Custom Elements Yes, but… Have been using it for 3

    years Has its limitations Wouldn't use it for applications
  3. My thoughts Great to sprinkle Javascript on top of content

    websites More accessible out of the box than a everything-in-JS approach Probably run into limits when using for applications
  4. Internationalization API Format dates, numbers and plurals The browser already

    has all languages Your browser knows your user's preferences
  5. Internationalization API new Intl.RelativeTimeFormat( 'en', // Any valid locale ).format(

    value, // A number, positive = future, negative = past unit // 'months', 'days', 'years', … )
  6. Internationalization API new Intl.RelativeTimeFormat('en').format(1, 'day') in 1 day new Intl.RelativeTimeFormat('nl').format(-1,

    'year') 1 jaar geleden new Intl.RelativeTimeFormat('fr').format(0, 'month') dans 0 mois
  7. That's not very human new Intl.RelativeTimeFormat('en').format(1, 'day') in 1 day

    new Intl.RelativeTimeFormat('fr').format(0, 'month') dans 0 mois
  8. That's not very human new Intl.RelativeTimeFormat( 'en', { numeric: 'auto'

    } ).format(1, 'day') tomorrow ce mois-ci new Intl.RelativeTimeFormat( 'fr', { numeric: 'auto' } ).format(0, 'month')
  9. Internalization API Definitely! Save bandwidth on translation files All edge

    cases handled automatically Locale 'default' uses your user's preferences
  10. OK, I cheated a little. The code that calculates the

    date difference adds another 30 lines.
  11. ES Modules Yes, with caution Definitely needs HTTP/2 No problem

    for small amount of modules Watch out for huge dependency trees