'Conditional rules based on Root element

Is there any way to access the root element in Less and style based on that? For example I have below styles:

div.myPage
{
   table{
       tr{ 
          &:not(.detail-row) {
              &:hover {
                  background-color: @gridHoverBgColor;
                  background-image: none;
              }
           }
       } 
   }
} 

Now, if in some case I don't need hover effect, I am adding a custom class to main Div (Unfortunately I can't add it directly on the row (tr)). So based on this new class I will have to repeat the whole styles again:

&.noHover{
   table{
      tr....//logic to not show hover
   }
}

Can I do it without repeating the whole styles again?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source