Hacker News new | ask | show | jobs
by myfonj 1042 days ago
And maybe some folks could be interested about little known fact that each selector has even a namespace part on the left; the void implicit one having effect depending on presence or absence of `@namespace` prologue in given stylesheet: - In stylesheet without explicit unnamed namespace it is like '*|', so everything is like `*|<element-selector>`; - In stylesheet with explicit unnamed namespace (`@namespace "<URI>");`) all element selectors without `<some-prefix>|<element-selector>` match only elements from that namespace. - In stylesheet with explicit named namespace (`@namespace <name> "<URI>";`) all element selectors with `<name>|<element-selector>` match only elements from that namespace.

    @namespace "bogus"; /* unnamed */
    @namespace aitchtee "http://www.w3.org/1999/xhtml";
    @namespace esvee "http://www.w3.org/2000/svg";
    * {  /* will not match anything, because "bogus" NS */ } 
    html {  /* also nothing, because "bogus" NS */ } 
    *|* { /* will match everything */ }
    aitchtee|title { /* will not match SVG title element, only the HTML one */ }
    aitchtee|*:root { /* will match html */ }
    esvee|* { /* all SVG elements */ }