mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	LibWeb: Allow white space inside pseudo-class arguments
This commit is contained in:
		
							parent
							
								
									10a594e6fe
								
							
						
					
					
						commit
						1e0e8b27c0
					
				
					 1 changed files with 20 additions and 4 deletions
				
			
		|  | @ -369,9 +369,14 @@ public: | |||
|         return original_index != index; | ||||
|     } | ||||
| 
 | ||||
|     bool is_valid_selector_char(char ch) const | ||||
|     static bool is_valid_selector_char(char ch) | ||||
|     { | ||||
|         return isalnum(ch) || ch == '-' || ch == '_' || ch == '(' || ch == ')' || ch == '@'; | ||||
|         return isalnum(ch) || ch == '-' || ch == '+' || ch == '_' || ch == '(' || ch == ')' || ch == '@'; | ||||
|     } | ||||
| 
 | ||||
|     static bool is_valid_selector_args_char(char ch) | ||||
|     { | ||||
|         return is_valid_selector_char(ch) || ch == ' ' || ch == '\t'; | ||||
|     } | ||||
| 
 | ||||
|     bool is_combinator(char ch) const | ||||
|  | @ -513,8 +518,19 @@ public: | |||
|                     return {}; | ||||
|                 buffer.append(')'); | ||||
|             } else { | ||||
|                 while (is_valid_selector_char(peek())) | ||||
|                 int nesting_level = 0; | ||||
|                 while (true) { | ||||
|                     const auto ch = peek(); | ||||
|                     if (ch == '(') | ||||
|                         ++nesting_level; | ||||
|                     else if (ch == ')' && nesting_level > 0) | ||||
|                         --nesting_level; | ||||
| 
 | ||||
|                     if (nesting_level > 0 ? is_valid_selector_args_char(ch) : is_valid_selector_char(ch)) | ||||
|                         buffer.append(consume_one()); | ||||
|                     else | ||||
|                         break; | ||||
|                 }; | ||||
|             } | ||||
| 
 | ||||
|             auto pseudo_name = String::copy(buffer); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 miere43
						miere43