* 5.4.3. Consume a qualified rule * https://www.w3.org/TR/css-syntax-3/#consume-a-qualified-rule
()
| 569 | * https://www.w3.org/TR/css-syntax-3/#consume-a-qualified-rule |
| 570 | */ |
| 571 | public consumeAQualifiedRule(): QualifiedRule { |
| 572 | const qualifiedRule: QualifiedRule = { |
| 573 | type: 'qualified-rule', |
| 574 | prelude: [], |
| 575 | block: undefined, |
| 576 | }; |
| 577 | let inputToken: InputToken; |
| 578 | while ((inputToken = this.consumeAToken())) { |
| 579 | if (inputToken === '{') { |
| 580 | qualifiedRule.block = this.consumeASimpleBlock(inputToken); |
| 581 | |
| 582 | return qualifiedRule; |
| 583 | } else if ((<InputTokenObject>inputToken).type === TokenObjectType.simpleBlock) { |
| 584 | const simpleBlock: SimpleBlock = <SimpleBlock>inputToken; |
| 585 | if (simpleBlock.associatedToken === '{') { |
| 586 | qualifiedRule.block = simpleBlock; |
| 587 | |
| 588 | return qualifiedRule; |
| 589 | } |
| 590 | } |
| 591 | this.reconsumeTheCurrentInputToken(inputToken); |
| 592 | const componentValue = this.consumeAComponentValue(); |
| 593 | if (componentValue) { |
| 594 | qualifiedRule.prelude.push(componentValue); |
| 595 | } |
| 596 | } |
| 597 | |
| 598 | // TODO: This is a parse error, log parse errors! |
| 599 | return null; |
| 600 | } |
| 601 | |
| 602 | /** |
| 603 | * 5.4.6. Consume a component value |
no test coverage detected