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

Method parseIDSelector

parser.go:293–308  ·  view source on GitHub ↗

parseIDSelector parses a selector that matches by id attribute.

()

Source from the content-addressed store, hash-verified

291
292// parseIDSelector parses a selector that matches by id attribute.
293func (p *parser) parseIDSelector() (Selector, error) {
294 if p.i >= len(p.s) {
295 return nil, fmt.Errorf("expected id selector (#id), found EOF instead")
296 }
297 if p.s[p.i] != '#' {
298 return nil, fmt.Errorf("expected id selector (#id), found '%c' instead", p.s[p.i])
299 }
300
301 p.i++
302 id, err := p.parseName()
303 if err != nil {
304 return nil, err
305 }
306
307 return attributeEqualsSelector("id", id), nil
308}
309
310// parseClassSelector parses a selector that matches by class attribute.
311func (p *parser) parseClassSelector() (Selector, error) {

Callers 1

Calls 2

parseNameMethod · 0.95
attributeEqualsSelectorFunction · 0.85

Tested by

no test coverage detected