(input, comment)
| 2057 | * @returns {Stylesheet} the parsed stylesheet |
| 2058 | */ |
| 2059 | const parseAStylesheet = (input, comment) => { |
| 2060 | // 1. If input is a byte stream for a stylesheet, decode bytes from input, and set input to the result. |
| 2061 | // 2. Normalize input, and set input to the result. |
| 2062 | const ts = normalizeIntoTokenStream(input, 0, comment); |
| 2063 | useObjectBackend(ts.locConverter); |
| 2064 | // 3. Create a new stylesheet, with its location set to location (or null, if location was not passed). |
| 2065 | const start = ts.next().start; |
| 2066 | const stylesheet = /** @type {Stylesheet} */ (_mkStylesheet(start)); |
| 2067 | // 4. Consume a stylesheet's contents from input, and set the stylesheet's rules to the result. |
| 2068 | _setRules(stylesheet, consumeAStylesheetsContents(ts)); |
| 2069 | _setEnd(stylesheet, ts.next().start); |
| 2070 | // 5. Return the stylesheet. |
| 2071 | return stylesheet; |
| 2072 | }; |
| 2073 | |
| 2074 | /** |
| 2075 | * Parse a stylesheet's contents, CSS Syntax Level 3 |
no test coverage detected