terribleMia’s avatarterribleMia’s Twitter Archive—№ 7,025

    1. Specificity math is like semantic versioning – each number is totally independent, and you never roll over between columns. v1.22.3 != v3.2.3 - <major>.<minor>.<patch> - <ids>.<attrs>.<types> (classes are just spicy attributes…)
  1. …in reply to @TerribleMia
    When comparing, you can read a single column at a time - left to right. If the major version or number of IDs differ, nothing else matters. 0.253.1 < 1.93.71 < 2.0.0 (I hope no one ever encounters those first two selectors…)
    1. …in reply to @TerribleMia
      This can extend (in author styles) to include eg: <importance>.<ids>.<attrs>.<types>.<order> Because "specificity" is just one part of a larger cascade. The part determined by selectors. Importance and source order apply to individual properties.
      1. …in reply to @TerribleMia
        Stepping out of author styles, we can add origin – which is actually tied to importance: <origin/importance>.<ids>.<attrs>.<types>.<order>
        1. …in reply to @TerribleMia
          Inline styles should also be represented. Could give that its own column: <origin/import>.<inline>.<ids>.<attrs>.<types>.<order> An inline style will never have additional selector columns, but that still works…