MCPcopy Create free account
hub / github.com/andybalholm/cascadia / parseIDSelector

Method parseIDSelector

parser.go:317–332  ·  view source on GitHub ↗

parseIDSelector parses a selector that matches by id attribute.

()

Source from the content-addressed store, hash-verified

315
316// parseIDSelector parses a selector that matches by id attribute.
317func (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.
335func (p *parser) parseClassSelector() (classSelector, error) {

Callers 1

Calls 1

parseNameMethod · 0.95

Tested by

no test coverage detected