parseIDSelector parses a selector that matches by id attribute.
()
| 315 | |
| 316 | // parseIDSelector parses a selector that matches by id attribute. |
| 317 | func (p *parser) parseIDSelector() (idSelector, error) { |
| 318 | if p.i >= len(p.s) { |
| 319 | return idSelector{}, fmt.Errorf("expected id selector (#id), found EOF instead") |
| 320 | } |
| 321 | if p.s[p.i] != '#' { |
| 322 | return idSelector{}, fmt.Errorf("expected id selector (#id), found '%c' instead", p.s[p.i]) |
| 323 | } |
| 324 | |
| 325 | p.i++ |
| 326 | id, err := p.parseName() |
| 327 | if err != nil { |
| 328 | return idSelector{}, err |
| 329 | } |
| 330 | |
| 331 | return idSelector{id: id}, nil |
| 332 | } |
| 333 | |
| 334 | // parseClassSelector parses a selector that matches by class attribute. |
| 335 | func (p *parser) parseClassSelector() (classSelector, error) { |
no test coverage detected