Get defined CSS classes by pattern
Is there any possiblity get all defined CSS classes matching a pattern?
For example if you have some CSS rules defined like:
.my-custom-class-one {}
.my-custom-class-two {}
.my-custom-class-three {}
I'd like to have something like:
console.log( getClassNamesByPattern('my-custom-class-*') );
returning a list of the matching classes:
[ 'my-custom-class-one', 'my-custom-class-two', 'my-custom-class-three' ]
There is no markup matching those selectors (yet). Actually that's what
i'd like to create...
I thought maybe something like getComputedStyles would do the trick, but
since it expects an element, which doesn't exists, it doesn't seem to be
of much use...
No comments:
Post a Comment