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

<noscript> The most useless tag of them all </n...

<noscript> The most useless tag of them all </noscript> @ CSS Day – HTML Special

HTML is special. Unlike many other languages the browser won’t show an error message when you make a mistake. Sure, that makes it easy to write bad code, but it also allows HTML to be both backwards and future compatible. It allowed the HTML5 specification to extend the existing form field types. It allowed the RICG to create the element. And it forms the basis of Web Components because it makes custom elements possible. And most importantly, it allows the tag, which by definition does absolutely nothing. This talk will explain the concepts behind graceful degradation, progressive enhancement and feature detection, and focus on how to solve practical problems with these concepts.

Niels Leenheer

June 16, 2016
Tweet

More Decks by Niels Leenheer

Other Decks in Technology

Transcript

  1. HTML is special. Unlike many other languages the browser won’t

    show an error message when you make a mistake. Sure, that makes it easy to write bad code, but it also allows HTML to be both backwards and future compatible. It allowed the HTML5 specification to extend the existing form field types. It allowed the RICG to create the <picture> element. And it forms the basis of Web Components because it makes custom elements possible. And most importantly, it allows the <noscript> tag, which by definition does absolutely nothing. This talk will explain the concepts behind graceful degradation, progressive enhancement and feature detection, and focus on how to solve practical problems with these concepts.
  2. <HEADER> <TITLE>The World Wide Web project</TITLE> <NEXTID N="55"> </HEADER> <BODY>

    <H1>World Wide Web</H1>The WorldWideWeb (W3) 
 is a wide-area
 <A NAME=0 HREF="WhatIs.html"> hypermedia</A> information retrieval initiative aiming to give universal access to a large universe of documents.<P> Everything there is online about W3 is linked directly or indirectly
  3. <noscript>
 What is this, 1995? Take a chill pill!
 Enable

    your JavaScript! Booyah!
 </noscript>
  4. <noscript>
 What is this, 1995? Take a chill pill!
 Enable

    your JavaScript! Booyah!
 </noscript>
  5. <script>
 confirm(
 'You will lose unsaved changes ' + 


    'if you cancel, is this OK?'
 );
 </script>
  6. <script>
 confirm(
 'You will lose unsaved changes ' + 


    'if you cancel, is this OK?'
 );
 </script>
  7. <script>
 <!--
 confirm(
 'You will lose unsaved changes ' +

    
 'if you cancel, is this OK?'
 );
 //-->
 </script>
  8. <script>
 <!--
 confirm(
 'You will lose unsaved changes ' +

    
 'if you cancel, is this OK?'
 );
 //-->
 </script>
  9. @keyframes blink { 0% { visibility: visible; } 50% {

    visibility: hidden; } } blink { animation: blink 1s steps(1) infinite; }
  10. {
 type: 'tag open' name: 'a', attributes: [ { name:

    'href', value: '#' }
 ] } <a href="#">
  11. Data state – Character reference in data state – RCDATA

    state – Character reference in RCDATA state – RAWTEXT state – Script data state – PLAINTEXT state – Tag open state – End tag open state – Tag name state – RCDATA less-than sign state – RCDATA end tag open state – RCDATA end tag name state – RAWTEXT less-than sign state – RAWTEXT end tag open state – RAWTEXT end tag name state – Script data less-than sign state – Script data end tag open state – Script data end tag name state – Script data escape start state – Script data escape start dash state – Script data escaped state – Script data escaped dash state – Script data escaped dash dash state – Script data escaped less-than sign state – Script data escaped end tag open state – Script data escaped end tag name state – Script data double escape start state – Script data double escaped state – Script data double escaped dash state – Script data double escaped dash dash state – Script data double escaped less-than sign state – Script data double escape end state – Before attribute name state – Attribute name state – After attribute name state – Before attribute value state – Attribute value (double-quoted) state – Attribute value (single-quoted) state – Attribute value (unquoted) state – Character reference in attribute value state – After attribute value (quoted) state – Self-closing start tag state – Bogus comment state – Markup declaration open state – Comment start state – Comment start dash state – Comment state – Comment end dash state – Comment end state – Comment end bang state – DOCTYPE state – Before DOCTYPE name state – DOCTYPE name state – After DOCTYPE name state – After DOCTYPE public keyword state – Before DOCTYPE public identifier state – DOCTYPE public identifier (double-quoted) state – DOCTYPE public identifier (single-quoted) state – After DOCTYPE public identifier state – Between DOCTYPE public and system identifiers state – After DOCTYPE system keyword state – Before DOCTYPE system identifier state – DOCTYPE system identifier (double-quoted) state – DOCTYPE system identifier (single- quoted) state – After DOCTYPE system identifier state – Bogus DOCTYPE state – CDATA section state
  12. find ~ -type f -name '*.html' -print0 | 
 xargs

    -0 -L1 perl -C -p -i -e 's/<a h/<a\x{2007}h/g'
  13. find ~ -type f -name '*.html' -print0 | 
 xargs

    -0 -L1 perl -C -p -i -e 's/<a /<a\x{2007}/g'
  14. custom elements custom dom interface for your own element receive

    events when an element is 
 created, attached or detached, 
 and when attributes are changed
  15. {
 type: 'tag open' name: 'a', attributes: [ { name:

    'href', value: '#' }
 ] } {
 type: 'tag close' name: 'a' } {
 type: 'character' value: '' }
  16. <b> 1 <i> 2 </b> 3 </i> A C B

    3 
 Bold Italic 3 
 Italic 3 
 Regular
  17. <b> 1 <i> 2 </b> 3 </i> Text : 1

    HTMLElement : b HTMLBodyElement
  18. <b> 1 <i> 2 </b> 3 </i> HTMLElement : i

    HTMLElement : b HTMLBodyElement Text : 1
  19. <b> 1 <i> 2 </b> 3 </i> HTMLElement : i

    HTMLElement : b HTMLBodyElement Text : 1 Text : 2
  20. <b> 1 <i> 2 </b> 3 </i> HTMLElement : i

    HTMLElement : b HTMLBodyElement Text : 1 Text : 2
  21. <b> 1 <i> 2 </b> 3 </i> HTMLElement : i

    HTMLElement : b HTMLBodyElement Text : 1 Text : 2
  22. <b> 1 <i> 2 </b> 3 </i> HTMLElement : i

    HTMLElement : b HTMLBodyElement Text : 1 Text : 2
  23. <b> 1 <i> 2 </b> 3 </i> HTMLElement : b

    HTMLElement : i HTMLElement : i HTMLBodyElement Text : 1 Text : 3 Text : 2
  24. <b> 1 <i> 2 </b> 3 </i> HTMLElement : b

    HTMLElement : i HTMLElement : i HTMLBodyElement Text : 1 Text : 3 Text : 2
  25. HTMLElement : b HTMLElement : i HTMLElement : i <b>

    1 <i> 2 </b> 3 </i> HTMLBodyElement Text : 1 Text : 3 Text : 2
  26. <b> 1 <i> 2 </b> 3 </i> A C B

    3 
 Bold Italic 3 
 Italic 3 
 Regular
  27. <b> 1 <i> 2 </b> 3 </i> A C 3

    
 Bold Italic 3 
 Italic 3 
 Regular B
  28. HTMLElement <b> <u> <code> <var> <kbd> <samp> <sub> <rtc> <i>

    <mark> <ruby> <rb> <rt> <rp> <bdi> <bdo> <wbr>
  29. <DD> A summary of the history of the project. <DT><A

    NAME=37 HREF="Helping.html">How can I help</A> ? <DD> If you would like to support the web.. <DT><A NAME=48 HREF="../README.html">Getting code</A> <DD> Getting the code by<A NAME=49 HREF="LineMode/Defaults/Distribution.html"> anonymous FTP</A> , etc.</A> </DL> </BODY>
  30. <noscript> 1 <noscript> 2 </noscript> 3 </noscript> Text : 3

    HTMLElement : noscript Text : 1 <noscript> 2 HTMLBodyElement
  31. <noscript> 1 <noscript> 2 </noscript> 3 </noscript> Text : 3

    HTMLElement : noscript Text : 1 <noscript> 2 HTMLBodyElement
  32. no