File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ module Pseudo exposing (..)
2+
3+ import Element exposing (..)
4+ import Element.Background as Background
5+ import Element.Font as Font
6+
7+
8+ main =
9+ Element . layout
10+ [ Background . color ( rgba 0 0 0 1 )
11+ , Font . color ( rgba 1 1 1 1 )
12+ , Font . italic
13+ , Font . size 32
14+ , Font . family
15+ [ Font . sansSerif ]
16+ ]
17+ <|
18+ column [ centerX, centerY ]
19+ [ el
20+ [ mouseOver [ Background . color <| rgb255 255 0 0 ]
21+ , mouseDown [ Background . color <| rgb255 0 0 255 ]
22+ ]
23+ <|
24+ text " The following priority of pseudo classes is fixed"
25+ , el
26+ [ mouseDown [ Background . color <| rgb255 0 0 255 ]
27+ , mouseOver [ Background . color <| rgb255 255 0 0 ]
28+ ]
29+ <|
30+ text " hover < focused < active"
31+ ]
Original file line number Diff line number Diff line change @@ -2622,7 +2622,21 @@ toStyleSheetString options stylesheet =
26222622 in
26232623 case List . foldl combine { topLevel = [], rules = [] } stylesheet of
26242624 { topLevel, rules } ->
2625- renderTopLevelValues topLevel ++ String . concat rules
2625+ let
2626+ ruleWeight s =
2627+ if String . contains " :hover" s then
2628+ 1
2629+
2630+ else if String . contains " :focus" s then
2631+ 2
2632+
2633+ else if String . contains " :active" s then
2634+ 3
2635+
2636+ else
2637+ 0
2638+ in
2639+ renderTopLevelValues topLevel ++ String . concat ( List . sortBy ruleWeight rules)
26262640
26272641
26282642renderStyle : OptionRecord -> Maybe PseudoClass -> String -> List Property -> List String
You can’t perform that action at this time.
0 commit comments