directives-bubling.less 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. //simple case: @document
  2. .parent {
  3. color:green;
  4. @document url-prefix() {
  5. .child {
  6. color:red;
  7. }
  8. }
  9. }
  10. //selectors joinings test
  11. .top {
  12. @supports (sandwitch: butter) {
  13. .inside & {
  14. property: value;
  15. }
  16. }
  17. }
  18. @supports (sandwitch: bread) {
  19. .in1 {
  20. .in2 {
  21. property: value;
  22. }
  23. }
  24. }
  25. .top {
  26. .inside & {
  27. @supports (sandwitch: ham) {
  28. property: value;
  29. }
  30. }
  31. }
  32. //combined with @font-face which has different kind of body
  33. @supports (font-family: weirdFont) {
  34. @font-face {
  35. font-family: something;
  36. src: made-up-url;
  37. }
  38. }
  39. @font-face {
  40. @supports not (-webkit-font-smoothing: subpixel-antialiased) {
  41. font-family: something;
  42. src: made-up-url;
  43. }
  44. }
  45. //bubling through media
  46. @supports (property: value) {
  47. .outOfMedia & {
  48. @media (max-size: 2px) {
  49. @supports (whatever: something) {
  50. property: value;
  51. }
  52. }
  53. }
  54. }
  55. .onTop & {
  56. @supports (property: value) {
  57. @media (max-size: 2px) {
  58. @supports (whatever: something) {
  59. property: value;
  60. }
  61. }
  62. }
  63. }
  64. //long combination of supports and media
  65. @media print {
  66. html {
  67. in-html: visible;
  68. @supports (upper: test) {
  69. in-supports: first;
  70. div {
  71. in-div: visible;
  72. @supports not (-webkit-font-smoothing: subpixel-antialiased) {
  73. in-supports: second;
  74. @media screen {
  75. font-weight: 400;
  76. nested {
  77. property: value;
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. }
  85. //another long combination of supports and media
  86. @media print {
  87. @media (max-size: 2px) {
  88. .in1 {
  89. stay: here;
  90. @supports not (-webkit-font-smoothing: subpixel-antialiased) {
  91. .in2 & {
  92. @supports (whatever: something) {
  93. property: value;
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. //called from mixin
  101. .nestedSupportsMixin() {
  102. font-weight: 300;
  103. -webkit-font-smoothing: subpixel-antialiased;
  104. @supports not (-webkit-font-smoothing: subpixel-antialiased) {
  105. font-weight: 400;
  106. nested {
  107. property: value;
  108. }
  109. }
  110. }
  111. html {
  112. .nestedSupportsMixin;
  113. }
  114. // selectors should not propagate into all directive types
  115. .onTop {
  116. @font-face {
  117. font-family: something;
  118. src: made-up-url;
  119. }
  120. @keyframes "textscale" {
  121. 0% { font-size : 1em; }
  122. 100% { font-size : 2em; }
  123. }
  124. animation : "textscale";
  125. font-family : something;
  126. }