lavr: csstext_to_pairs results are stripped and sorted again.
diff --git a/premailer/merge_style.py b/premailer/merge_style.py
index 0fe93f7..9842e63 100644
--- a/premailer/merge_style.py
+++ b/premailer/merge_style.py
@@ -1,5 +1,6 @@
 import cssutils
 import threading
+from operator import itemgetter
 
 
 def csstext_to_pairs(csstext):
@@ -10,11 +11,10 @@ def csstext_to_pairs(csstext):
     # The lock is required to avoid ``cssutils`` concurrency
     # issues documented in issue #65
     with csstext_to_pairs._lock:
-        parsed = cssutils.css.CSSVariablesDeclaration(csstext)
-        return [
-            (key.strip(), parsed.getVariableValue(key).strip())
-            for key in sorted(parsed)
-        ]
+        return sorted([(prop.name.strip(), prop.propertyValue.cssText.strip())
+                       for prop in cssutils.parseStyle(csstext)],
+                      key=itemgetter(0))
+
 
 csstext_to_pairs._lock = threading.RLock()
 

SyntaxErr on <h1> with !important
Feeding the following into ```transform()``` results in a ```SyntaxErr```:

```
<style type="text/css">
h1 { border:1px solid black }
p { color:red;}
</style>
<p>Hey</p>
<h1 style="display: block;font-family: Helvetica;font-size: 26px;font-style: normal;font-weight: bold;line-height: 100%;letter-spacing: normal;margin-top: 0;margin-right: 0;margin-bottom: 10px;margin-left: 0;text-align: left;color: #202020 !important;">Some Stuff</h1>
```

Results in:

```
SyntaxErr: PropertyValue: Missing token for production Choice(ColorValue, Dimension, URIValue, Value, variable, MSValue, CSSCalc, function): ('CHAR', '!', 1, 230)
```

Removing the ```!important``` from the inline style on the H1 allows it to be inlined as expected.
diff --git a/premailer/tests/test_merge_style.py b/premailer/tests/test_merge_style.py
index 7a8a215..0d4d11f 100644
--- a/premailer/tests/test_merge_style.py
+++ b/premailer/tests/test_merge_style.py
@@ -1,7 +1,5 @@
 from __future__ import absolute_import, unicode_literals
 import unittest
-import xml
-from nose.tools import raises
 from premailer.merge_style import csstext_to_pairs, merge_styles
 
 
@@ -14,9 +12,13 @@ class TestMergeStyle(unittest.TestCase):
         parsed_csstext = csstext_to_pairs(csstext)
         self.assertEqual(('font-size', '1px'), parsed_csstext[0])
 
-    @raises(xml.dom.SyntaxErr)
     def test_inline_invalid_syntax(self):
-        # inline shouldn't have those as I understand
-        # but keep the behaviour
+        # Invalid syntax does not raise
         inline = '{color:pink} :hover{color:purple} :active{color:red}'
         merge_styles(inline, [], [])
+
+    def test_important_rule(self):
+        # No exception after #133
+        csstext = 'font-size:1px !important'
+        parsed_csstext = csstext_to_pairs(csstext)
+        self.assertEqual(('font-size', '1px'), parsed_csstext[0])

pip install -e .
parse_log_pytest
requirements.txt
nose mock coverage pytest
3.4
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
cssselect==1.1.0
cssutils==2.3.1
importlib-metadata==4.8.3
iniconfig==1.1.1
lxml==5.3.1
mock==5.2.0
nose==1.3.7
packaging==21.3
pluggy==1.0.0
-e git+https://github.com/peterbe/premailer.git@e5e1feb7d63fc7499702d70e3197ad3d293e90bf#egg=premailer
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

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
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_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
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - 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
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - coverage==6.2
      - cssselect==1.1.0
      - cssutils==2.3.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - lxml==5.3.1
      - mock==5.2.0
      - nose==1.3.7
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/premailer

premailer/tests/test_merge_style.py::TestMergeStyle::test_important_rule premailer/tests/test_merge_style.py::TestMergeStyle::test_inline_invalid_syntax
premailer/tests/test_merge_style.py::TestMergeStyle::test_csstext_to_pairs
premailer/merge_style.py
premailer/merge_style.py