getUrls method for single CSSRule, not CSSStyleSheet?
- Dominant language
- Python
- Stars
- 92
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
currently `getUrls` method could be applied to `CSSStyleSheet` object only. Is there a simple way to get urls from single CSS rule?
My workaround is like following:
```python
from cssutils import CSSParser
from cssutils.css import CSSStyleRule
from cssutils.css import CSSStyleSheet
from cssutils import getUrls
parser = CSSParser()
style = parser.parseStyle(cssText="height:450px; background-image: url('https://example.com/image.png');")
rule = CSSStyleRule(selectorText="html", style=style)
css = CSSStyleSheet()
css.add(rule)
print(list(getUrls(css)))
```
but it seems to be a bit over-engineered. Is there a better/faster way?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the getUrls entry point and the CSSRule and CSSStyleSheet APIs mentioned in the issue. Check how getUrls traverses a stylesheet, then determine whether the same URL extraction can support a single CSSRule directly. Done means retrieving the URL from the provided CSSStyleRule without wrapping it in a CSSStyleSheet, with coverage for the demonstrated style.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100