Skip to content Skip to sidebar Skip to footer

Html5 Custom Elements Wildcard Css Selector

I have a bunch of custom HTML elements such ass bar-el, bar-el2, foo, foo-bar, foo-bar-2. I can do the following:

Solution 1:

You cannot do regexp selectors on tag names. You can only perform regexps on attribute values.

You could create your own JavaScript function that fetches all elements using document.querySelectorAll('*'), do a string comparison on the tagName property for each element in the result, and only return the elements that match.

If you cannot modify the HTML to create a common attribute, I would prefer to just write out all the variants.

Post a Comment for "Html5 Custom Elements Wildcard Css Selector"