coveralls: 
[![Coverage Status](https://coveralls.io/builds/12542863/badge)](https://coveralls.io/builds/12542863)

Coverage remained the same at 100.0% when pulling **b4509c51881fb2ace20f6af569f2e44aa0c900da on no-exclude_pseudoclasses-without-selector-value** into **597b57740c661df8b3f4f5bdec7c495afe955275 on master**.

diff --git a/premailer/premailer.py b/premailer/premailer.py
index 7cfb186..0a8c40d 100644
--- a/premailer/premailer.py
+++ b/premailer/premailer.py
@@ -250,6 +250,9 @@ class Premailer(object):
                     continue
                 elif '*' in selector and not self.include_star_selectors:
                     continue
+                elif selector.startswith(':'):
+                    continue
+
                 # Crudely calculate specificity
                 id_count = selector.count('#')
                 class_count = selector.count('.')
@@ -274,6 +277,7 @@ class Premailer(object):
                         len(rules)  # this is the rule's index number
                     )
                     rules.append((specificity, selector, bulk))
+
         return rules, leftover
 
     def transform(self, pretty_print=True, **kwargs):
@@ -401,6 +405,7 @@ class Premailer(object):
             else:
                 selector = new_selector
 
+            assert selector
             sel = CSSSelector(selector)
             items = sel(page)
             if len(items):

Crashing when using on Semantic with exclude_pseudoclasses=False
Tried running this script:
```
# Just a test script for premailer

import premailer

html = """
    <html>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"/>
    <style>
        h1{ border: 1px solid blue}
        h1:hover {border: 1px solid green}
        
    </style>
    <h1>Hey</h1>
    </html>
"""

p = premailer.Premailer(html, exclude_pseudoclasses=False)
print(p.transform())
```

but it crashes and returns:
```
...
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
WARNING	Property: Unknown Property name.
Traceback (most recent call last):
  File "prem.py", line 18, in <module>
    print(p.transform())
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/premailer/premailer.py", line 404, in transform
    sel = CSSSelector(selector)
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/lxml/cssselect.py", line 94, in __init__
    path = translator.css_to_xpath(css)
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/cssselect/xpath.py", line 192, in css_to_xpath
    for selector in parse(css))
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/cssselect/parser.py", line 355, in parse
    return list(parse_selector_group(stream))
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/cssselect/parser.py", line 370, in parse_selector_group
    yield Selector(*parse_selector(stream))
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/cssselect/parser.py", line 378, in parse_selector
    result, pseudo_element = parse_simple_selector(stream)
  File "/home/jddantes/.conda/envs/pulse/lib/python3.6/site-packages/cssselect/parser.py", line 480, in parse_simple_selector
    "Expected selector, got %s" % (stream.peek(),))
cssselect.parser.SelectorSyntaxError: Expected selector, got <EOF at 0>

```

premailer==3.0.0
lxml==3.8.0
diff --git a/premailer/tests/test_premailer.py b/premailer/tests/test_premailer.py
index dc7f2c1..fa5c2eb 100644
--- a/premailer/tests/test_premailer.py
+++ b/premailer/tests/test_premailer.py
@@ -2622,3 +2622,53 @@ sheet" type="text/css">
         )
         result_html = p.transform()
         compare_html(expect_html, result_html)
+
+    def test_pseudo_selectors_without_selector(self):
+        """Happens when you have pseudo selectors without an actual selector.
+        Which means it's not possible to find it in the DOM.
+
+        For example:
+
+           <style>
+           :before{box-sizing:inherit}
+           </style>
+
+        Semantic-UI uses this in its normalizer.
+
+        Original issue: https://github.com/peterbe/premailer/issues/184
+        """
+
+        html = """
+            <html>
+            <style>
+                 *,:after,:before{box-sizing:inherit}
+                h1{ border: 1px solid blue}
+                h1:hover {border: 1px solid green}
+
+            </style>
+            <h1>Hey</h1>
+            </html>
+        """
+
+        expect_html = """
+<html>
+    <head>
+    <style>
+         *,:after,:before{box-sizing:inherit}
+        h1{ border: 1px solid blue}
+        h1:hover {border: 1px solid green}
+
+    </style>
+    </head>
+    <body>
+    <h1 style="{border:1px solid blue} :hover{border:1px solid green}">Hey</h1>
+    </body>
+</html>
+        """
+        p = Premailer(
+            html,
+            exclude_pseudoclasses=False,
+            keep_style_tags=True,
+        )
+        result_html = p.transform()
+        compare_html(expect_html, result_html)

pip install -e .
parse_log_pytest
pytest
nose mock coverage pytest
pip install tox coveralls
3.5
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
coveralls==3.3.1
cssselect==1.1.0
cssutils==2.3.1
distlib==0.3.9
docopt==0.6.2
filelock==3.4.1
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
lxml==5.3.1
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
-e git+https://github.com/peterbe/premailer.git@597b57740c661df8b3f4f5bdec7c495afe955275#egg=premailer
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
requests==2.27.1
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tox==3.28.0
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: premailer
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==2.0.12
      - coverage==6.2
      - coveralls==3.3.1
      - cssselect==1.1.0
      - cssutils==2.3.1
      - distlib==0.3.9
      - docopt==0.6.2
      - filelock==3.4.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - importlib-resources==5.4.0
      - lxml==5.3.1
      - mock==5.2.0
      - nose==1.3.7
      - platformdirs==2.4.0
      - requests==2.27.1
      - six==1.17.0
      - tox==3.28.0
      - urllib3==1.26.20
      - virtualenv==20.17.1
prefix: /opt/conda/envs/premailer

premailer/tests/test_premailer.py::Tests::test_pseudo_selectors_without_selector
premailer/tests/test_premailer.py::Tests::test_3_digit_color_expand premailer/tests/test_premailer.py::Tests::test_align_float_images premailer/tests/test_premailer.py::Tests::test_apple_newsletter_example premailer/tests/test_premailer.py::Tests::test_base_url_fixer premailer/tests/test_premailer.py::Tests::test_base_url_with_path premailer/tests/test_premailer.py::Tests::test_basic_html premailer/tests/test_premailer.py::Tests::test_basic_html_shortcut_function premailer/tests/test_premailer.py::Tests::test_basic_html_with_pseudo_selector premailer/tests/test_premailer.py::Tests::test_basic_xml premailer/tests/test_premailer.py::Tests::test_broken_xml premailer/tests/test_premailer.py::Tests::test_capture_cssutils_logging premailer/tests/test_premailer.py::Tests::test_child_selector premailer/tests/test_premailer.py::Tests::test_command_line_fileinput_from_argument premailer/tests/test_premailer.py::Tests::test_command_line_fileinput_from_stdin premailer/tests/test_premailer.py::Tests::test_command_line_preserve_style_tags premailer/tests/test_premailer.py::Tests::test_comments_in_media_queries premailer/tests/test_premailer.py::Tests::test_css_disable_basic_html_attributes premailer/tests/test_premailer.py::Tests::test_css_disable_leftover_css premailer/tests/test_premailer.py::Tests::test_css_text premailer/tests/test_premailer.py::Tests::test_css_text_with_only_body_present premailer/tests/test_premailer.py::Tests::test_css_with_html_attributes premailer/tests/test_premailer.py::Tests::test_css_with_pseudoclasses_excluded premailer/tests/test_premailer.py::Tests::test_css_with_pseudoclasses_included premailer/tests/test_premailer.py::Tests::test_disabled_validator premailer/tests/test_premailer.py::Tests::test_doctype premailer/tests/test_premailer.py::Tests::test_empty_style_tag premailer/tests/test_premailer.py::Tests::test_external_links premailer/tests/test_premailer.py::Tests::test_external_links_unfindable premailer/tests/test_premailer.py::Tests::test_external_styles_and_links premailer/tests/test_premailer.py::Tests::test_external_styles_on_http premailer/tests/test_premailer.py::Tests::test_external_styles_on_https premailer/tests/test_premailer.py::Tests::test_external_styles_with_base_url premailer/tests/test_premailer.py::Tests::test_favour_rule_with_class_over_generic premailer/tests/test_premailer.py::Tests::test_favour_rule_with_element_over_generic premailer/tests/test_premailer.py::Tests::test_favour_rule_with_id_over_others premailer/tests/test_premailer.py::Tests::test_favour_rule_with_important_over_others premailer/tests/test_premailer.py::Tests::test_fontface_selectors_with_no_selectortext premailer/tests/test_premailer.py::Tests::test_ignore_some_external_stylesheets premailer/tests/test_premailer.py::Tests::test_ignore_some_incorrectly premailer/tests/test_premailer.py::Tests::test_ignore_some_inline_stylesheets premailer/tests/test_premailer.py::Tests::test_ignore_style_elements_with_media_attribute premailer/tests/test_premailer.py::Tests::test_include_star_selector premailer/tests/test_premailer.py::Tests::test_inline_important premailer/tests/test_premailer.py::Tests::test_inline_wins_over_external premailer/tests/test_premailer.py::Tests::test_keyframe_selectors premailer/tests/test_premailer.py::Tests::test_last_child premailer/tests/test_premailer.py::Tests::test_last_child_exclude_pseudo premailer/tests/test_premailer.py::Tests::test_leftover_important premailer/tests/test_premailer.py::Tests::test_links_without_protocol premailer/tests/test_premailer.py::Tests::test_load_external_url premailer/tests/test_premailer.py::Tests::test_mailto_url premailer/tests/test_premailer.py::Tests::test_mediaquery premailer/tests/test_premailer.py::Tests::test_merge_styles_basic premailer/tests/test_premailer.py::Tests::test_merge_styles_non_trivial premailer/tests/test_premailer.py::Tests::test_merge_styles_with_class premailer/tests/test_premailer.py::Tests::test_merge_styles_with_unset premailer/tests/test_premailer.py::Tests::test_mixed_pseudo_selectors premailer/tests/test_premailer.py::Tests::test_multiple_style_elements premailer/tests/test_premailer.py::Tests::test_multithreading premailer/tests/test_premailer.py::Tests::test_parse_style_rules premailer/tests/test_premailer.py::Tests::test_precedence_comparison premailer/tests/test_premailer.py::Tests::test_prefer_inline_to_class premailer/tests/test_premailer.py::Tests::test_remove_classes premailer/tests/test_premailer.py::Tests::test_remove_unset_properties premailer/tests/test_premailer.py::Tests::test_shortcut_function premailer/tests/test_premailer.py::Tests::test_six_color premailer/tests/test_premailer.py::Tests::test_strip_important premailer/tests/test_premailer.py::Tests::test_style_attribute_specificity premailer/tests/test_premailer.py::Tests::test_style_block_with_external_urls premailer/tests/test_premailer.py::Tests::test_tel_url premailer/tests/test_premailer.py::Tests::test_turnoff_cache_works_as_expected premailer/tests/test_premailer.py::Tests::test_type_test premailer/tests/test_premailer.py::Tests::test_uppercase_margin premailer/tests/test_premailer.py::Tests::test_xml_cdata
premailer/premailer.py
premailer/premailer.py