(
buffer: &mut String,
remainder: &RuleRemainder<'i>,
declarations: &[parser::Declaration<'i>],
)
| 306 | } |
| 307 | |
| 308 | fn append_rule<'i>( |
| 309 | buffer: &mut String, |
| 310 | remainder: &RuleRemainder<'i>, |
| 311 | declarations: &[parser::Declaration<'i>], |
| 312 | ) { |
| 313 | let (start, end) = remainder.declarations; |
| 314 | if start >= end || end > declarations.len() { |
| 315 | return; |
| 316 | } |
| 317 | let mut selectors_iter = remainder.selectors.iter().peekable(); |
| 318 | while let Some(selector) = selectors_iter.next() { |
| 319 | buffer.push_str(selector); |
| 320 | if selectors_iter.peek().is_some() { |
| 321 | buffer.push_str(", "); |
| 322 | } |
| 323 | } |
| 324 | buffer.push_str(" {"); |
| 325 | for (name, value) in &declarations[start..end] { |
| 326 | buffer.push(' '); |
| 327 | buffer.push_str(name); |
| 328 | buffer.push(':'); |
| 329 | buffer.push(' '); |
| 330 | let value_trimmed = value.trim(); |
| 331 | buffer.push_str(value_trimmed); |
| 332 | if !value_trimmed.ends_with(';') { |
| 333 | buffer.push(';'); |
| 334 | } |
| 335 | } |
| 336 | buffer.push_str(" }\n"); |
| 337 | } |
| 338 | |
| 339 | fn overwrite_style_node(document: &mut Document, node_id: NodeId, new_css: &str) { |
| 340 | let new_css = new_css.trim(); |
no test coverage detected