https://drafts.csswg.org/css-syntax-3/#consume-list-of-components
(p: &mut Parser<'a, Iter>)
| 20 | impl<'a> Parse<'a> for ComponentValues<'a> { |
| 21 | // https://drafts.csswg.org/css-syntax-3/#consume-list-of-components |
| 22 | fn parse<Iter>(p: &mut Parser<'a, Iter>) -> Result<Self> |
| 23 | where |
| 24 | Iter: Iterator<Item = Cursor> + Clone, |
| 25 | { |
| 26 | let mut values = Vec::new_in(p.bump()); |
| 27 | let mut last_was_whitespace = false; |
| 28 | |
| 29 | loop { |
| 30 | if p.at_end() { |
| 31 | break; |
| 32 | } |
| 33 | if p.next_is_stop() { |
| 34 | break; |
| 35 | } |
| 36 | if let Some(mut value) = p.parse_if_peek::<ComponentValue>()? { |
| 37 | if let ComponentValue::Delim(d) = value |
| 38 | && last_was_whitespace |
| 39 | && d.associated_whitespace().contains(AssociatedWhitespaceRules::EnforceAfter) |
| 40 | { |
| 41 | let rules = d.associated_whitespace() | AssociatedWhitespaceRules::EnforceBefore; |
| 42 | value = ComponentValue::Delim(d.with_associated_whitespace(rules)) |
| 43 | } |
| 44 | last_was_whitespace = matches!(value, ComponentValue::Whitespace(_)); |
| 45 | values.push(value); |
| 46 | } else { |
| 47 | break; |
| 48 | } |
| 49 | } |
| 50 | Ok(Self { values }) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | impl<'a, M: NodeMetadata> NodeWithMetadata<M> for ComponentValues<'a> { |
nothing calls this directly
no test coverage detected