Repository: facelessuser/soupsieve

Issue:
Attribute selectors vs \n in values
Hi! Thanks for the powerful library. 

I use it via BeautifulSoup, and I find out this behavior:
```python
from bs4 import BeautifulSoup

soup = BeautifulSoup("<p><span title='foo bar'>foo1</span><span title='foo\nbar'>foo1</span></p>", 'html.parser')
print(*soup.select('span[title*="bar"]'))
```
I expected this to print both spans, but the actual output is 
```
<span title="foo bar">foo1</span>
```
It seems that `*=` considers only the first line of multi-line attribute:
```python
print(*soup.select('span[title*="foo"]'))
```
prints this:
```
<span title="foo bar">foo1</span> <span title="foo
bar">foo1</span>
```
Is there some bug, or some conscious limitation, or `\n` in attribute values is against the standard?
Thanks!

Discussion:
facelessuser: @gir-bot lgtm

Patch:
diff --git a/docs/src/markdown/about/changelog.md b/docs/src/markdown/about/changelog.md
index d5f603b..5baba14 100644
--- a/docs/src/markdown/about/changelog.md
+++ b/docs/src/markdown/about/changelog.md
@@ -1,5 +1,9 @@
 # Changelog
 
+## 2.3.1
+
+- **FIX**: Ensure attribute selectors match tags that have new lines characters in attributes. (#233)
+
 ## 2.3
 
 - **NEW**: Officially support Python 3.10.
diff --git a/soupsieve/__meta__.py b/soupsieve/__meta__.py
index 2d40a9c..2d769fb 100644
--- a/soupsieve/__meta__.py
+++ b/soupsieve/__meta__.py
@@ -192,5 +192,5 @@ def parse_version(ver: str) -> Version:
     return Version(major, minor, micro, release, pre, post, dev)
 
 
-__version_info__ = Version(2, 3, 0, "final")
+__version_info__ = Version(2, 3, 1, "final")
 __version__ = __version_info__._get_canonical()
diff --git a/soupsieve/css_parser.py b/soupsieve/css_parser.py
index 55e2ab9..0536b80 100644
--- a/soupsieve/css_parser.py
+++ b/soupsieve/css_parser.py
@@ -484,12 +484,12 @@ class CSSParser:
         value = ''
 
         if case:
-            flags = re.I if case == 'i' else 0
+            flags = (re.I if case == 'i' else 0) | re.DOTALL
         elif util.lower(attr) == 'type':
-            flags = re.I
+            flags = re.I | re.DOTALL
             is_type = True
         else:
-            flags = 0
+            flags = re.DOTALL
 
         if op:
             if m.group('value').startswith(('"', "'")):


Test patch:
diff --git a/tests/test_level3/test_attribute.py b/tests/test_level3/test_attribute.py
index 6075e69..dc78eff 100644
--- a/tests/test_level3/test_attribute.py
+++ b/tests/test_level3/test_attribute.py
@@ -60,3 +60,53 @@ class TestAttribute(util.TestCase):
             ["0", "3", "pre"],
             flags=util.HTML
         )
+
+    def test_attribute_contains_with_newlines(self):
+        """Test attribute `*=` will match with new lines."""
+
+        self.assert_selector(
+            "<p><span id='1' title='foo bar'>foo1</span><span id='2' title='foo\nbar'>foo1</span></p>",
+            "span[title*='bar']",
+            ["1", "2"],
+            flags=util.HTML
+        )
+
+    def test_attribute_starts_with_newlines(self):
+        """Test attribute `^=` will match with new lines."""
+
+        self.assert_selector(
+            "<p><span id='1' title='foo bar'>foo1</span><span id='2' title='foo\nbar'>foo1</span></p>",
+            "span[title^='foo']",
+            ["1", "2"],
+            flags=util.HTML
+        )
+
+    def test_attribute_ends_with_newlines(self):
+        """Test attribute `$=` will match with new lines."""
+
+        self.assert_selector(
+            "<p><span id='1' title='foo bar'>foo1</span><span id='2' title='foo\nbar'>foo1</span></p>",
+            "span[title$='bar']",
+            ["1", "2"],
+            flags=util.HTML
+        )
+
+    def test_attribute_dash_list_with_newlines(self):
+        """Test attribute `|=` will match with new lines."""
+
+        self.assert_selector(
+            "<p><span id='1' title='fo-o bar'>foo1</span><span id='2' title='fo-o\nbar'>foo1</span></p>",
+            "span[title|='fo']",
+            ["1", "2"],
+            flags=util.HTML
+        )
+
+    def test_attribute_space_list_with_newlines(self):
+        """Test attribute `~=` will match with new lines."""
+
+        self.assert_selector(
+            "<p><span id='1' title='foo bar baz'>foo1</span><span id='2' title='foo\nbar baz'>foo1</span></p>",
+            "span[title~='baz']",
+            ["1", "2"],
+            flags=util.HTML
+        )