stadeus
  • Login
Show Navigation
  • Public

    • Groups
    • Recent tags

Notices tagged with html5

  1. Tantek ()'s status on Saturday, 16-Mar-2024 00:35:00 EDT Tantek Tantek
    While an HTML style element for inline CSS needs nothing but simple start and end tags (as of HTML5 and later)

    <style>
    p { margin:0 }
    </style>

    a more robust style element requires a precise series of overlapping code comments.

    Here is the answer if you want a code snippet to copy & paste

    <style><!--/*--><![CDATA[*/
    p { margin:0 } /* you may delete this sample style rule */
    /*]]><!--*/--></style>


    Here is why:

    1. Not all HTML processors are CSS processors. While all modern browsers know how to parse CSS in style elements inside HTML, it is still quite reasonable for people to build HTML processors that do not, and many exist. There are plenty of ways that errant or deliberately misplaced markup inside a style element, like in a CSS comment, that such processors will not see, that can break them and cause unexpected and different results in different processors.

    Thus it makes your HTML more parseable, by more processors, if you can hide the entirety of the style sheet inside the style elmenet from such processing. A CDATA section does exactly that:

    <style><![CDATA[
    p { margin:0 } /* CDATA allows a </style> here to not close the element */
    body > p { margin:1em } /* CDATA allows an unescaped > child combinator */
    ]]></style>


    2. However CSS syntax does not recognize a CDATA directive (even as of the latest published CSS Syntax Module Level 3¹ or editor's draft² as of this writing). CSS parsers may very well treat a CDATA directive as a syntax error that invalidates the subsequent style rule.

    Thus we must hide the CDATA directive, its opening and closing markup, from CSS parsers.  CSS code comments /* ... */ can do exactly that:

    <style>/* <![CDATA[*/
    p { margin:0 } /* CDATA allows a </style> here to not close the element */
    body > p { margin:1em } /* CDATA allows an unescaped > child combinator */
    /*]]>*/</style>


    3. This is close but still exposes HTML processors that do not process CSS to a minimal bit of content, the CSS comment opener and closer that are outside the CDATA section:

    /* */

    This recently showed up in a draft of the This Week in The #IndieWeb newsletter³, because portions of it are automatically constructed by parsing the HTML of MediaWiki pages for content, and one of those used a MediaWiki template that included a minimal style element to style the marked up content inserted by the template. A draft of the newsletter was showing raw CSS, extracted as text from the style element by the CSS-unaware parser extracting content. I was able to hide nearly all of it using CSS comments around the CDATA section opener and closer. Except for that little bit of CSS comment noise outside the CDATA section: /* */

    Fortunately there is one more tool in our toolbox that we can use. Simple HTML/SGML comments <!-- --> are ignored at the start and end of style sheets⁴ (noted there as CDO-token⁵ and CDC-token⁶), and thus we can use those to hide the last two remaining CSS comment pieces that were leaking out, like this: <!-- /* --> and <!-- */ -->. Note that the portion of the HTML comment directives that are inside CSS comments are ignored by CSS processors, which is why this works for both processors that parse CSS and those that do not.

    This last addition produces our answer, with no fewer than three different comment mechanisms (CDATA, CSS, HTML/SGML), overlapping to hide each other from different processors:

    <style><!--/*--><![CDATA[*/
    p { margin:0 } /* CDATA allows a </style> here to not close the element */
    body > p { margin:1em } /* CDATA allows an unescaped > child combinator */
    /*]]><!--*/--></style>

    By replacing those informative style rules with a style rule to be deleted, we have recreated the code snippet to copy & paste from the top of the post:

    <style><!--/*--><![CDATA[*/
    p { margin:0 } /* you may delete this sample style rule */
    /*]]><!--*/--></style>

    Q.E.D.


    Afterword:

    If you View Source on this original permalink or my home page you can see the more robust style element in a real world example, following the IndieWeb Use What You Make⁷ principle.

    #CSS #style #styleElement #styleSheet #HTML #HTML5 #CSSsyntax #codecomments


    Glossary:

    CDATA
      https://en.wikipedia.org/wiki/CDATA
    CSS — Cascading Style Sheets
      https://en.wikipedia.org/wiki/CSS
    HTML — HyperText Markup Language
      https://en.wikipedia.org/wiki/HTML
    HTML5
      https://en.wikipedia.org/wiki/HTML5
    IndieWeb Principles
      https://indieweb.org/principles
    MediaWiki
      https://en.wikipedia.org/wiki/MediaWiki
    original permalink
      https://indieweb.org/original_permalink
    Q.E.D.
      https://en.wikipedia.org/wiki/Q.E.D.

    References:

    ¹ https://www.w3.org/TR/css-syntax-3/
    ² https://drafts.csswg.org/css-syntax/
    ³ https://indieweb.org/this-week-in-the-indieweb
    ⁴ https://www.w3.org/TR/css-syntax-3/#stylesheet-diagram
    ⁵ https://www.w3.org/TR/css-syntax-3/#CDO-token-diagram
    ⁶ https://www.w3.org/TR/css-syntax-3/#CDC-token-diagram
    ⁷ https://indieweb.org/use_what_you_make
    about a year ago from tantek.com permalink
  2. MMN-o ✅⃠ (mmn)'s status on Saturday, 20-May-2017 14:48:56 EDT MMN-o ✅⃠ MMN-o ✅⃠
    • Defective by Design
    • BeeMcBeeface
    @einebiene Netflix explicitly has been actively promoting, pushing and implementing #EME in #HTML5 as we know from @dbd et al.
    DVDs are bad but not I-don't-want-to-communicate-with-such-a-bad-person bad.
    Saturday, 20-May-2017 14:48:56 EDT from social.umeahackerspace.se permalink
  3. Tantek ()'s status on Wednesday, 18-Jan-2017 13:49:52 EST Tantek Tantek
    #HTML5 instead of YouTube video of music + album art:
    <video src="m.mp3" poster="a.jpg" controls=""></video>
    ht: @zcorpan
    Wednesday, 18-Jan-2017 13:49:52 EST from tantek.com permalink
  4. MMN-o ✅⃠ (mmn)'s status on Sunday, 15-Jan-2017 16:19:27 EST MMN-o ✅⃠ MMN-o ✅⃠
    • Petter SA2PKA Karkea
    @fnadde42 Meh, what does it matter when #Netflix has made sure to implement #DRM in #HTML5 and thus noone will be able to right-click to copy anything at all anyway?
    Sunday, 15-Jan-2017 16:19:27 EST from social.umeahackerspace.se permalink
  5. mjd (mjd)'s status on Wednesday, 16-Dec-2015 06:02:54 EST mjd mjd
    And no, #BBC et al., the problem isn't that "Media playback is unsupported on [my] device", it's that the open standard for media playback isn't supported by you. #NoScript #HTML5
    Wednesday, 16-Dec-2015 06:02:54 EST from microblog.ourcoffs.org.au permalink Repeated by cmhobbs
  6. mjd (mjd)'s status on Wednesday, 16-Dec-2015 06:02:54 EST mjd mjd
    And no, #BBC et al., the problem isn't that "Media playback is unsupported on [my] device", it's that the open standard for media playback isn't supported by you. #NoScript #HTML5
    Wednesday, 16-Dec-2015 06:02:54 EST from microblog.ourcoffs.org.au permalink
  7. MMN-o ✅⃠ (mmn)'s status on Wednesday, 14-Oct-2015 05:12:27 EDT MMN-o ✅⃠ MMN-o ✅⃠
    in reply to
    • cyberunions
    • gnusocial
    @cyberunions Yes you have new listeners. And they're coming from !gnusocial :] I'm wondering however if you could add time tags (I think that should be pretty easy with an #HTML5 player and simple javascript - or people who don't u…
    Wednesday, 14-Oct-2015 05:12:27 EDT from social.umeahackerspace.se permalink

    Attachments

    1. mmn-20151014-ostatus-dwz6.html
  8. Former Bob Jonkman -- Please use the new server at https://gs.jonkman.ca (bobjonkmanformer)'s status on Thursday, 09-Jul-2015 23:42:01 EDT Former Bob Jonkman -- Please use the new server at https://gs.jonkman.ca Former Bob Jonkman -- Please use the new server at https://gs.jonkman.ca
    in reply to
    • Former Bob Jonkman -- Please use the new server at https://gs.jonkman.ca
    Thanx @CBC, @CBCradio! #HTML5 support would be good; a link to plain audio files (mp3, ogg) would be better
    Thursday, 09-Jul-2015 23:42:01 EDT from sn.jonkman.ca permalink
  9. MMN-o ✅⃠ (mmn)'s status on Sunday, 12-Apr-2015 08:28:22 EDT MMN-o ✅⃠ MMN-o ✅⃠
    Just reminding everyone: #Netflix coerced the #W3C into implementing #DRM in #HTML5. They e…
    Sunday, 12-Apr-2015 08:28:22 EDT from social.umeahackerspace.se permalink

    Attachments

    1. mmn-20150412T122955-ku4nfrc.html
  10. aroque (aroque)'s status on Wednesday, 11-Mar-2015 19:27:49 EDT aroque aroque
    • gnusocial
    I attached a video to a notice on my local !gnusocial install. On pages containing that notice, #firefox…
    Wednesday, 11-Mar-2015 19:27:49 EDT from gnusocial.no permalink

    Attachments

    1. -20150311T232913-ycwdhtl.html
  11. MMN-o ✅⃠ (mmn)'s status on Tuesday, 24-Feb-2015 20:23:23 EST MMN-o ✅⃠ MMN-o ✅⃠
    • gnusocial
    • Qvitter
    Developing is too fun. Especially when I generally just complete stuff I've half-completed …
    Tuesday, 24-Feb-2015 20:23:23 EST from social.umeahackerspace.se permalink

    Attachments

    1. -20150225T013207-jcxwku2.html
  12. MMN-o ✅⃠ (mmn)'s status on Thursday, 08-Jan-2015 12:00:28 EST MMN-o ✅⃠ MMN-o ✅⃠
    in reply to
    • laurelrusswurm
    The element even uses the #HTML5 <time/> and is, I believe, properly marked up for #microformats2 ;)
    Thursday, 08-Jan-2015 12:00:28 EST from social.umeahackerspace.se permalink
  13. erkanyilmaz (erkanyilmaz)'s status on Saturday, 18-Jan-2014 17:52:42 EST erkanyilmaz erkanyilmaz
    in reply to
    #HTML5 visualizations of aesthetic proof-of-work schemes for #cryptocurrencies. e.g. "Cryptocu…
    Saturday, 18-Jan-2014 17:52:42 EST from oracle.skilledtests.com permalink Repeated by robmyers
  14. erkanyilmaz (erkanyilmaz)'s status on Saturday, 18-Jan-2014 17:52:42 EST erkanyilmaz erkanyilmaz
    in reply to
    #HTML5 visualizations of aesthetic proof-of-work schemes for #cryptocurrencies. e.g. "Cryptocu…
    Saturday, 18-Jan-2014 17:52:42 EST from oracle.skilledtests.com permalink
  15. lnxw37 (lnxwalt on quitter) (lnxw37)'s status on Sunday, 08-Dec-2013 09:54:42 EST lnxw37 (lnxwalt on quitter) lnxw37 (lnxwalt on quitter)
    • inscius
    @inscius That is my experience also, even with the #HTML5 addon.
    Sunday, 08-Dec-2013 09:54:42 EST from quitter.se permalink
  16. lnxw37 (lnxw37)'s status on Thursday, 24-Oct-2013 21:11:11 EDT lnxw37 lnxw37
    • Markov Dosto(y)evsky
    @question I am starting to hate #YouTube. Whenever I visit to hear a song it wants #flash, not #HTML5. Rubbish.
    Thursday, 24-Oct-2013 21:11:11 EDT from federati.net permalink Repeated by lnxw37
  17. lnxw37 (lnxw37)'s status on Thursday, 24-Oct-2013 21:11:11 EDT lnxw37 lnxw37
    • Markov Dosto(y)evsky
    @question I am starting to hate #YouTube. Whenever I visit to hear a song it wants #flash, not #HTML5. Rubbish.
    Thursday, 24-Oct-2013 21:11:11 EDT from federati.net permalink
  18. erkanyilmaz (erkanyilmaz)'s status on Wednesday, 31-Jul-2013 08:49:43 EDT erkanyilmaz erkanyilmaz
    • Markov Dosto(y)evsky
    • clone of Mr. Oracle
    Congrats! 5 days ago @hellekin and team finished Volume I, Number 0 of their monthly #newslett…
    Wednesday, 31-Jul-2013 08:49:43 EDT from oracle.skilledtests.com permalink Repeated by marc0s

    Attachments

    1. erkanyilmaz-20130731T131831-nkp64fa.html
  19. erkanyilmaz (erkanyilmaz)'s status on Wednesday, 31-Jul-2013 08:49:43 EDT erkanyilmaz erkanyilmaz
    • Markov Dosto(y)evsky
    • clone of Mr. Oracle
    Congrats! 5 days ago @hellekin and team finished Volume I, Number 0 of their monthly #newslett…
    Wednesday, 31-Jul-2013 08:49:43 EDT from oracle.skilledtests.com permalink

    Attachments

    1. erkanyilmaz-20130731T131831-nkp64fa.html
  20. Hugo Soucy (hs0ucy)'s status on Sunday, 16-Jun-2013 10:55:14 EDT Hugo Soucy Hugo Soucy
    «5 HTML5 Features you need to know» ~ http://yh5.ca/95 #WebDev #HTML5
    Sunday, 16-Jun-2013 10:55:14 EDT from status.soucy.cc permalink
  • Before
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

stadeus is a social network, courtesy of blaise.ca. It runs on GNU social, version 1.2.0-beta4, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All stadeus content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.