diff options
-rw-r--r-- | src/css/match.nim | 3 | ||||
-rw-r--r-- | test/layout/nested-hover-selector.expected | 2 | ||||
-rw-r--r-- | test/layout/nested-hover-selector.html | 8 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/css/match.nim b/src/css/match.nim index 5a4f81d2..ffd6bf9b 100644 --- a/src/css/match.nim +++ b/src/css/match.nim @@ -216,7 +216,7 @@ func matches(element: Element; sels: CompoundSelector; func matches*(element: Element; cxsel: ComplexSelector; depends: var DependencyInfo): bool = var e = element - var pmatch = mtFalse + var pmatch = mtTrue var mdepends = DependencyInfo() for i in countdown(cxsel.high, 0): var match = mtFalse @@ -258,6 +258,7 @@ func matches*(element: Element; cxsel: ComplexSelector; if match == mtFalse: return false # we can discard depends. if pmatch == mtContinue and match == mtTrue or e == nil: + pmatch = mtContinue break # we must update depends. pmatch = match depends.merge(mdepends) diff --git a/test/layout/nested-hover-selector.expected b/test/layout/nested-hover-selector.expected new file mode 100644 index 00000000..078ed88b --- /dev/null +++ b/test/layout/nested-hover-selector.expected @@ -0,0 +1,2 @@ + + • li diff --git a/test/layout/nested-hover-selector.html b/test/layout/nested-hover-selector.html new file mode 100644 index 00000000..4f61edeb --- /dev/null +++ b/test/layout/nested-hover-selector.html @@ -0,0 +1,8 @@ +<style> +ul ul { display: none } +ul li:hover ul { display: block } +</style> +<ul> +<li>li +<ul id=x> +test |