mirror of
				https://github.com/lightpanda-io/browser.git
				synced 2025-10-30 15:41:48 +00:00 
			
		
		
		
	css: implement legend siblings check for :disabled
This commit is contained in:
		| @@ -508,14 +508,26 @@ pub const Selector = union(enum) { | |||||||
|         }; |         }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     fn hasLegendInPreviousSiblings(n: anytype) anyerror!bool { | ||||||
|  |         var c = try n.prevSibling(); | ||||||
|  |         while (c != null) { | ||||||
|  |             const ctag = try c.?.tag(); | ||||||
|  |             if (std.ascii.eqlIgnoreCase("legend", ctag)) return true; | ||||||
|  |             c = try c.?.prevSibling(); | ||||||
|  |         } | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     fn inDisabledFieldset(n: anytype) anyerror!bool { |     fn inDisabledFieldset(n: anytype) anyerror!bool { | ||||||
|         const p = try n.parent(); |         const p = try n.parent(); | ||||||
|         if (p == null) return false; |         if (p == null) return false; | ||||||
|  |  | ||||||
|  |         const ntag = try n.tag(); | ||||||
|         const ptag = try p.?.tag(); |         const ptag = try p.?.tag(); | ||||||
|  |  | ||||||
|         if (std.ascii.eqlIgnoreCase("fieldset", ptag) and |         if (std.ascii.eqlIgnoreCase("fieldset", ptag) and | ||||||
|             try p.?.attr("disabled") != null) |             try p.?.attr("disabled") != null and | ||||||
|  |             (!std.ascii.eqlIgnoreCase("legend", ntag) or try hasLegendInPreviousSiblings(n))) | ||||||
|         { |         { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Pierre Tachoire
					Pierre Tachoire