Hello community,
here is the log from the commit of package python-soupsieve for
openSUSE:Factory checked in at 2020-01-01 14:57:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-soupsieve (Old)
and /work/SRC/openSUSE:Factory/.python-soupsieve.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-soupsieve"
Wed Jan 1 14:57:43 2020 rev:7 rq:758624 version:1.9.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-soupsieve/python-soupsieve.changes
2019-09-23 12:04:07.485937920 +0200
+++
/work/SRC/openSUSE:Factory/.python-soupsieve.new.6675/python-soupsieve.changes
2020-01-01 14:58:23.661934111 +0100
@@ -1,0 +2,13 @@
+Fri Dec 20 18:49:34 UTC 2019 - Dirk Mueller <[email protected]>
+
+- update to 1.9.5:
+ * **FIX**: `:placeholder-shown` should not match if the element has content
+ that overrides the pl aceholder.
+ * **FIX**: `:checked` rule was too strict with `option` elements. The
+ specification for `:checked ` does not require an `option` element to be
under
+ a `select` element.
+ * **FIX**: Fix level 4 `:lang()` wildcard match handling with singletons.
+ Implicit wildcard match ing should not match any singleton. Explicit wildcard
+ matching (`*` in the language range: `*-US`) is allowed to match singletons.
+
+-------------------------------------------------------------------
Old:
----
soupsieve-1.9.3.tar.gz
New:
----
soupsieve-1.9.5.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-soupsieve.spec ++++++
--- /var/tmp/diff_new_pack.wwXEfN/_old 2020-01-01 14:58:24.053934315 +0100
+++ /var/tmp/diff_new_pack.wwXEfN/_new 2020-01-01 14:58:24.053934315 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-soupsieve
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,7 @@
%bcond_with test
%endif
Name: python-soupsieve%{psuffix}
-Version: 1.9.3
+Version: 1.9.5
Release: 0
Summary: A modern CSS selector implementation for BeautifulSoup
License: MIT
++++++ soupsieve-1.9.3.tar.gz -> soupsieve-1.9.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/PKG-INFO new/soupsieve-1.9.5/PKG-INFO
--- old/soupsieve-1.9.3/PKG-INFO 2019-08-18 03:06:21.000000000 +0200
+++ new/soupsieve-1.9.5/PKG-INFO 2019-11-02 15:48:12.000000000 +0100
@@ -1,12 +1,13 @@
Metadata-Version: 2.1
Name: soupsieve
-Version: 1.9.3
+Version: 1.9.5
Summary: A modern CSS selector implementation for Beautiful Soup.
Home-page: https://github.com/facelessuser/soupsieve
Author: Isaac Muse
Author-email: [email protected]
License: MIT License
-Description: [![Unix Build Status][travis-image]][travis-link]
+Description: [![Build][github-ci-image]][github-ci-link]
+ [![Unix Build Status][travis-image]][travis-link]
[![Windows Build Status][appveyor-image]][appveyor-link]
[![Coverage Status][codecov-image]][codecov-link]
[![PyPI Version][pypi-image]][pypi-link]
@@ -88,12 +89,16 @@
[bs4]: https://beautiful-soup-4.readthedocs.io/en/latest/#
+ [github-ci-image]:
https://github.com/facelessuser/soupsieve/workflows/build/badge.svg
+ [github-ci-link]:
https://github.com/facelessuser/soupsieve/actions?workflow=build
+ [gitter-image]:
https://img.shields.io/gitter/room/facelessuser/soupsieve.svg
+ [gitter-link]: https://gitter.im/facelessuser/soupsieve
[codecov-image]:
https://img.shields.io/codecov/c/github/facelessuser/soupsieve/master.svg
[codecov-link]: https://codecov.io/github/facelessuser/soupsieve
- [travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
- [travis-link]: https://travis-ci.org/facelessuser/soupsieve
[appveyor-image]:
https://img.shields.io/appveyor/ci/facelessuser/soupsieve/master.svg?label=Windows%20Build&logo=appveyor
[appveyor-link]: https://ci.appveyor.com/project/facelessuser/soupsieve
+ [travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
+ [travis-link]: https://travis-ci.org/facelessuser/soupsieve
[pypi-image]:
https://img.shields.io/pypi/v/soupsieve.svg?logo=python&logoColor=white
[pypi-link]: https://pypi.python.org/pypi/soupsieve
[license-image-mit]: https://img.shields.io/badge/license-MIT-blue.svg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/README.md
new/soupsieve-1.9.5/README.md
--- old/soupsieve-1.9.3/README.md 2019-08-18 03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/README.md 2019-11-02 15:48:04.000000000 +0100
@@ -1,3 +1,4 @@
+[![Build][github-ci-image]][github-ci-link]
[![Unix Build Status][travis-image]][travis-link]
[![Windows Build Status][appveyor-image]][appveyor-link]
[![Coverage Status][codecov-image]][codecov-link]
@@ -80,12 +81,16 @@
[bs4]: https://beautiful-soup-4.readthedocs.io/en/latest/#
+[github-ci-image]:
https://github.com/facelessuser/soupsieve/workflows/build/badge.svg
+[github-ci-link]:
https://github.com/facelessuser/soupsieve/actions?workflow=build
+[gitter-image]: https://img.shields.io/gitter/room/facelessuser/soupsieve.svg
+[gitter-link]: https://gitter.im/facelessuser/soupsieve
[codecov-image]:
https://img.shields.io/codecov/c/github/facelessuser/soupsieve/master.svg
[codecov-link]: https://codecov.io/github/facelessuser/soupsieve
-[travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
-[travis-link]: https://travis-ci.org/facelessuser/soupsieve
[appveyor-image]:
https://img.shields.io/appveyor/ci/facelessuser/soupsieve/master.svg?label=Windows%20Build&logo=appveyor
[appveyor-link]: https://ci.appveyor.com/project/facelessuser/soupsieve
+[travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
+[travis-link]: https://travis-ci.org/facelessuser/soupsieve
[pypi-image]:
https://img.shields.io/pypi/v/soupsieve.svg?logo=python&logoColor=white
[pypi-link]: https://pypi.python.org/pypi/soupsieve
[license-image-mit]: https://img.shields.io/badge/license-MIT-blue.svg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/docs/src/dictionary/en-custom.txt
new/soupsieve-1.9.5/docs/src/dictionary/en-custom.txt
--- old/soupsieve-1.9.3/docs/src/dictionary/en-custom.txt 2019-08-18
03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/docs/src/dictionary/en-custom.txt 2019-11-02
15:48:04.000000000 +0100
@@ -1,6 +1,7 @@
API
Accessors
Aspell
+BCP
BeautifulSoup
CDATA
CSS
@@ -59,6 +60,8 @@
regex
sublicense
substring
+subtag
+subtags
traceback
tuple
tuples
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/docs/src/markdown/about/changelog.md
new/soupsieve-1.9.5/docs/src/markdown/about/changelog.md
--- old/soupsieve-1.9.3/docs/src/markdown/about/changelog.md 2019-08-18
03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/docs/src/markdown/about/changelog.md 2019-11-02
15:48:04.000000000 +0100
@@ -1,25 +1,36 @@
# Changelog
+## 1.9.5
+
+- **FIX**: `:placeholder-shown` should not match if the element has content
that overrides the placeholder.
+
+## 1.9.4
+
+- **FIX**: `:checked` rule was too strict with `option` elements. The
specification for `:checked` does not require an
+ `option` element to be under a `select` element.
+- **FIX**: Fix level 4 `:lang()` wildcard match handling with singletons.
Implicit wildcard matching should not
+ match any singleton. Explicit wildcard matching (`*` in the language range:
`*-US`) is allowed to match singletons.
+
## 1.9.3
- **FIX**: `[attr!=value]` pattern was mistakenly using `:not([attr|=value])`
logic instead of `:not([attr=value])`.
- **FIX**: Remove undocumented `_QUIRKS` mode flag. Beautiful Soup was meant
to use it to help with transition to Soup
-Sieve, but never released with it. Help with transition at this point is no
longer needed.
+ Sieve, but never released with it. Help with transition at this point is no
longer needed.
## 1.9.2
- **FIX**: Shortcut last descendant calculation if possible for performance.
- **FIX**: Fix issue where `Doctype` strings can be mistaken for a normal text
node in some cases.
- **FIX**: A top level tag is not a `:root` tag if it has sibling text nodes
or tag nodes. This is an issue that mostly
-manifests when using `html.parser` as the parser will allow multiple root
nodes.
+ manifests when using `html.parser` as the parser will allow multiple root
nodes.
## 1.9.1
- **FIX**: `:root`, `:contains()`, `:default`, `:indeterminate`, `:lang()`,
and `:dir()` will properly account for HTML
-`iframe` elements in their logic when selecting or matching an element. Their
logic will be restricted to the document
-for which the element under consideration applies.
+ `iframe` elements in their logic when selecting or matching an element.
Their logic will be restricted to the document
+ for which the element under consideration applies.
- **FIX**: HTML pseudo-classes will check that all key elements checked are in
the XHTML namespace (HTML parsers that do
-not provide namespaces will assume the XHTML namespace).
+ not provide namespaces will assume the XHTML namespace).
- **FIX**: Ensure that all pseudo-class names are case insensitive and allow
CSS escapes.
## 1.9.0
@@ -27,32 +38,32 @@
- **NEW**: Allow `:contains()` to accept a list of text to search for. (#115)
- **NEW**: Add new `escape` function for escaping CSS identifiers. (#125)
- **NEW**: Deprecate `comments` and `icomments` functions in the API to ensure
Soup Sieve focuses only on CSS selectors.
-`comments` and `icomments` will most likely be removed in 2.0. (#130)
+ `comments` and `icomments` will most likely be removed in 2.0. (#130)
- **NEW**: Add Python 3.8 support. (#133)
- **FIX**: Don't install test files when installing the `soupsieve` package.
(#111)
- **FIX**: Improve efficiency of `:contains()` comparison.
- **FIX**: Null characters should translate to the Unicode REPLACEMENT
CHARACTER (`U+FFFD`) according to the
-specification. This applies to CSS escaped NULL characters as well. (#124)
+ specification. This applies to CSS escaped NULL characters as well. (#124)
- **FIX**: Escaped EOF should translate to `U+FFFD` outside of CSS strings. In
a string, they should just be ignored,
-but as there is no case where we could resolve such a string and still have a
valid selector, string handling remains
-the same. (#128)
+ but as there is no case where we could resolve such a string and still have
a valid selector, string handling remains
+ the same. (#128)
## 1.8.0
- **NEW**: Add custom selector support. (#92)(#108)
- **FIX**: Small tweak to CSS identifier pattern to ensure it matches the CSS
specification exactly. Specifically, you
-can't have an identifier of only `-`. (#107)
+ can't have an identifier of only `-`. (#107)
- **FIX**: CSS string patterns should allow escaping newlines to span strings
across multiple lines. (#107)
- **FIX**: Newline regular expression for CSS newlines should treat `\r\n` as
a single character, especially in cases
-such as string escapes: `\\\r\n`. (#107)
+ such as string escapes: `\\\r\n`. (#107)
- **FIX**: Allow `--` as a valid identifier or identifier start. (#107)
- **FIX**: Bad CSS syntax now raises a `SelectorSyntaxError`, which is still
currently derived from `SyntaxError`, but
-will most likely be derived from `Exception` in the future.
+ will most likely be derived from `Exception` in the future.
## 1.7.3
- **FIX**: Fix regression with tag names in regards to case sensitivity, and
ensure there are tests to prevent breakage
-in the future.
+ in the future.
- **FIX**: XHTML should always be case sensitive like XML.
## 1.7.2
@@ -60,9 +71,9 @@
- **FIX**: Fix HTML detection `type` selector.
- **FIX**: Fixes for `:enabled` and `:disabled`.
- **FIX**: Provide a way for Beautiful Soup to parse selectors in a quirks
mode to mimic some of the quirks of the old
-select method prior to Soup Sieve, but with warnings. This is to help old
scripts to not break during the transitional
-period with newest Beautiful Soup. In the future, these quirks will raise an
exception as Soup Sieve requires
-selectors to follow the CSS specification.
+ select method prior to Soup Sieve, but with warnings. This is to help old
scripts to not break during the transitional
+ period with newest Beautiful Soup. In the future, these quirks will raise an
exception as Soup Sieve requires
+ selectors to follow the CSS specification.
## 1.7.1
@@ -75,7 +86,7 @@
- **NEW**: Add support for `:defined` selector. (#76)
- **FIX**: Fix pickling issue when compiled selector contains a `NullSelector`
object. (#70)
- **FIX**: Better exception messages in the CSS selector parser and fix a
position reporting issue that can occur in
-some exceptions. (#72, #73)
+ some exceptions. (#72, #73)
- **FIX**: Don't compare prefixes when evaluating attribute namespaces,
compare the actual namespace. (#75)
- **FIX**: Split whitespace attribute lists by all whitespace characters, not
just space.
- **FIX**: `:nth-*` patterns were converting numbers to base 16 when they
should have been converting to base 10.
@@ -117,20 +128,20 @@
- **NEW**: Add support for `:scope`.
- **NEW**: `:user-invalid`, `:playing`, `:paused`, and `:local-link` will not
cause a failure, but all will match
-nothing as their use cases are not possible in an environment outside a web
browser.
+ nothing as their use cases are not possible in an environment outside a web
browser.
- **FIX**: Fix `[attr~=value]` handling of whitespace. According to the spec,
if the value contains whitespace, or is an
-empty string, it should not match anything.
+ empty string, it should not match anything.
- **FIX**: Precompile internal patterns for pseudo-classes to prevent having
to parse them again.
## 1.2.1
- **FIX**: More descriptive exceptions. Exceptions will also now mention
position in the pattern that is problematic.
- **FIX**: `filter` ignores `NavigableString` objects in normal iterables and
`Tag` iterables. Basically, it filters all
-Beautiful Soup document parts regardless of iterable type where as it used to
only filter out a `NavigableString` in a
-`Tag` object. This is viewed as fixing an inconsistency.
+ Beautiful Soup document parts regardless of iterable type where as it used
to only filter out a `NavigableString` in a
+ `Tag` object. This is viewed as fixing an inconsistency.
- **FIX**: `DEBUG` flag has been added to help with debugging CSS selector
parsing. This is mainly for development.
- **FIX**: If forced to search for language in `meta` tag, and no language is
found, cache that there is no language in
-the `meta` tag to prevent searching again during the current select.
+ the `meta` tag to prevent searching again during the current select.
- **FIX**: If a non `BeautifulSoup`/`Tag` object is given to the API to
compare against, raise a `TypeError`.
## 1.2.0
@@ -142,26 +153,25 @@
- **NEW**: Adds support for `[attr!=value]` which is equivalent to
`:not([attr=value])`.
- **NEW**: Add support for `:active`, `:focus`, `:hover`, `:visited`,
`:target`, `:focus-within`, `:focus-visible`,
-`:target-within`, `:current()`/`:current`, `:past`, and `:future`, but they
will never match as these states don't
-exist
-in the Soup Sieve environment.
+ `:target-within`, `:current()`/`:current`, `:past`, and `:future`, but they
will never match as these states don't
+ exist in the Soup Sieve environment.
- **NEW**: Add support for `:checked`, `:enabled`, `:disabled`, `:required`,
`:optional`, `:default`, and
-`:placeholder-shown` which will only match in HTML documents as these concepts
are not defined in XML.
+ `:placeholder-shown` which will only match in HTML documents as these
concepts are not defined in XML.
- **NEW**: Add support for `:link` and `:any-link`, both of which will target
all `<a>`, `<area>`, and `<link>` elements
-with an `href` attribute as all links will be treated as unvisited in Soup
Sieve.
+ with an `href` attribute as all links will be treated as unvisited in Soup
Sieve.
- **NEW**: Add support for `:lang()` (CSS4) which works in XML and HTML.
- **NEW**: Users must install Beautiful Soup themselves. This requirement is
removed in the hopes that Beautiful Soup
-may use this in the future.
+ may use this in the future.
- **FIX**: Attributes in the form `prefix:attr` can be matched with the form
`[prefix\:attr]` without specifying a
-namespaces if desired.
+ namespaces if desired.
- **FIX**: Fix exception when `[type]` is used (with no value).
## 1.0.2
- **FIX**: Use proper CSS identifier patterns for tag names, classes, ids,
etc. Things like `#3` or `#-3` should not
-match and should require `#\33` or `#-\33`.
+ match and should require `#\33` or `#-\33`.
- **FIX**: Do not raise `NotImplementedError` for supported pseudo
classes/elements with bad syntax, instead raise
-`SyntaxError`.
+ `SyntaxError`.
## 1.0.1
@@ -177,7 +187,7 @@
- **NEW**: Drop document flags. Document type can be detected from the
Beautiful Soup object directly.
- **FIX**: CSS selectors should be evaluated with CSS whitespace rules.
- **FIX**: Processing instructions, CDATA, and declarations should all be
ignored in `:contains` and child
-considerations for `:empty`.
+ considerations for `:empty`.
- **FIX**: In Beautiful Soup, the document itself is the first tag. Do not
match the "document" tag by returning false
for any tag that doesn't have a parent.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/docs/src/markdown/selectors.md
new/soupsieve-1.9.5/docs/src/markdown/selectors.md
--- old/soupsieve-1.9.3/docs/src/markdown/selectors.md 2019-08-18
03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/docs/src/markdown/selectors.md 2019-11-02
15:48:04.000000000 +0100
@@ -1363,8 +1363,13 @@
Level 4 CSS<span class="lab badge"></span>
:
- The level 4 `:lang()` adds the ability to define multiple languages, the
ability to use `*` for wildcard language
- matching.
+ The level 4 CSS specifications adds the ability to define multiple
language tags using a comma separated list. The
+ specifications also allow for BCP 47 language ranges as described in
[RFC4647](https://tools.ietf.org/html/rfc4647)
+ for extended filtering. This enables implicit wildcard matching between
subtags. For instance, `:lang(de-DE)` will
+ match all of `de-DE`, `de-DE-1996`, `de-Latn-DE`, `de-Latf-DE`, and
`de-Latn-DE-1996`. Implicit wildcard matching
+ will not take place at the beginning on the primary language tag, `*` must
be used to force wildcard matching at the
+ beginning of the language. If desired an explicit wildcard between subtags
can be used, but since implicit wildcard
+ matching already takes place between subtags, it is not needed: `de-*-DE`
would be the same as just using `de-DE`.
```css tab="Syntax"
:lang('*-language', language2)
@@ -2002,6 +2007,17 @@
[<input id="0" placeholder="This is some text"/>, <textarea id="1"
placeholder="This is some text"></textarea>]
```
+!!! note "Parser Differences"
+ In general, when an input has a placeholder, but the element also has
valid content, the placeholder is not shown.
+ For instance, when a `textarea` has actual text associated with the
element, the placeholder is overridden with the
+ actual content. A `textarea` is allowed no more than a single newline to
be considered as having no content
+ (carriage returns don't count).
+
+ `html5lib` will strip out carriage returns, but `lxml` and `html.parser`
will not. This will cause a difference
+ between the parsers when dealing with Windows style line endings and
`textareas`. `html5lib` seems to follow
+ *closest* to what real browsers do. Soup Sieve is simply following the
specification as best it can. Unfortunately,
+ it can't account for the quirks of the parsers in this case without
introducing other issues.
+
!!! tip "Additional Reading"
https://developer.mozilla.org/en-US/docs/Web/CSS/:placeholder-shown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/requirements/flake8.txt
new/soupsieve-1.9.5/requirements/flake8.txt
--- old/soupsieve-1.9.3/requirements/flake8.txt 2019-08-18 03:04:56.000000000
+0200
+++ new/soupsieve-1.9.5/requirements/flake8.txt 1970-01-01 01:00:00.000000000
+0100
@@ -1,6 +0,0 @@
-flake8
-pydocstyle<4.0.0
-flake8_docstrings
-pep8-naming
-flake8-mutable
-flake8-builtins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/requirements/lint.txt
new/soupsieve-1.9.5/requirements/lint.txt
--- old/soupsieve-1.9.3/requirements/lint.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/soupsieve-1.9.5/requirements/lint.txt 2019-11-02 15:48:04.000000000
+0100
@@ -0,0 +1,6 @@
+flake8
+pydocstyle<4.0.0
+flake8_docstrings
+pep8-naming
+flake8-mutable
+flake8-builtins
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve/__meta__.py
new/soupsieve-1.9.5/soupsieve/__meta__.py
--- old/soupsieve-1.9.3/soupsieve/__meta__.py 2019-08-18 03:04:56.000000000
+0200
+++ new/soupsieve-1.9.5/soupsieve/__meta__.py 2019-11-02 15:48:04.000000000
+0100
@@ -186,5 +186,5 @@
return Version(major, minor, micro, release, pre, post, dev)
-__version_info__ = Version(1, 9, 3, "final")
+__version_info__ = Version(1, 9, 5, "final")
__version__ = __version_info__._get_canonical()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve/css_match.py
new/soupsieve-1.9.5/soupsieve/css_match.py
--- old/soupsieve-1.9.3/soupsieve/css_match.py 2019-08-18 03:04:56.000000000
+0200
+++ new/soupsieve-1.9.5/soupsieve/css_match.py 2019-11-02 15:48:04.000000000
+0100
@@ -43,6 +43,7 @@
RE_DATETIME = re.compile(
r'^(?P<year>[0-9]{4,})-(?P<month>[0-9]{2})-(?P<day>[0-9]{2})T(?P<hour>[0-9]{2}):(?P<minutes>[0-9]{2})$'
)
+RE_WILD_STRIP = re.compile(r'(?:(?:-\*-)(?:\*(?:-|$))*|-\*$)')
MONTHS_30 = (4, 6, 9, 11) # April, June, September, and November
FEB = 2
@@ -545,6 +546,57 @@
return ct.SEL_DIR_LTR if bidi == 'L' else ct.SEL_DIR_RTL
return None
+ def extended_language_filter(self, lang_range, lang_tag):
+ """Filter the language tags."""
+
+ match = True
+ lang_range = RE_WILD_STRIP.sub('-', lang_range).lower()
+ ranges = lang_range.split('-')
+ subtags = lang_tag.lower().split('-')
+ length = len(ranges)
+ rindex = 0
+ sindex = 0
+ r = ranges[rindex]
+ s = subtags[sindex]
+
+ # Primary tag needs to match
+ if r != '*' and r != s:
+ match = False
+
+ rindex += 1
+ sindex += 1
+
+ # Match until we run out of ranges
+ while match and rindex < length:
+ r = ranges[rindex]
+ try:
+ s = subtags[sindex]
+ except IndexError:
+ # Ran out of subtags,
+ # but we still have ranges
+ match = False
+ continue
+
+ # Empty range
+ if not r:
+ match = False
+ continue
+
+ # Matched range
+ elif s == r:
+ rindex += 1
+
+ # Implicit wildcard cannot match
+ # singletons
+ elif len(s) == 1:
+ match = False
+ continue
+
+ # Implicitly matched, so grab next subtag
+ sindex += 1
+
+ return match
+
def match_attribute_name(self, el, attr, prefix):
"""Match attribute name and return value if it exists."""
@@ -1100,7 +1152,7 @@
for patterns in langs:
match = False
for pattern in patterns:
- if pattern.match(found_lang):
+ if self.extended_language_filter(pattern, found_lang):
match = True
if not match:
break
@@ -1182,7 +1234,7 @@
out_of_range = False
- itype = self.get_attribute_by_name(el, 'type').lower()
+ itype = util.lower(self.get_attribute_by_name(el, 'type'))
mn = self.get_attribute_by_name(el, 'min', None)
if mn is not None:
mn = Inputs.parse_value(itype, mn)
@@ -1237,6 +1289,21 @@
self.get_prefix(el) is not None
)
+ def match_placeholder_shown(self, el):
+ """
+ Match placeholder shown according to HTML spec.
+
+ - text area should be checked if they have content. A single newline
does not count as content.
+
+ """
+
+ match = False
+ content = self.get_text(el)
+ if content in ('', '\n'):
+ match = True
+
+ return match
+
def match_selectors(self, el, selectors):
"""Check if element matches one of the selectors."""
@@ -1269,6 +1336,9 @@
# Verify element is scope
if selector.flags & ct.SEL_SCOPE and not self.match_scope(el):
continue
+ # Verify element has placeholder shown
+ if selector.flags & ct.SEL_PLACEHOLDER_SHOWN and not
self.match_placeholder_shown(el):
+ continue
# Verify `nth` matches
if not self.match_nth(el, selector.nth):
continue
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve/css_parser.py
new/soupsieve-1.9.5/soupsieve/css_parser.py
--- old/soupsieve-1.9.3/soupsieve/css_parser.py 2019-08-18 03:04:56.000000000
+0200
+++ new/soupsieve-1.9.5/soupsieve/css_parser.py 2019-11-02 15:48:04.000000000
+0100
@@ -190,6 +190,7 @@
FLG_OPEN = 0x40
FLG_IN_RANGE = 0x80
FLG_OUT_OF_RANGE = 0x100
+FLG_PLACEHOLDER_SHOWN = 0x200
# Maximum cached patterns to store
_MAXCACHE = 500
@@ -841,20 +842,12 @@
continue
value = token.group('value')
if value.startswith(('"', "'")):
- parts = css_unescape(value[1:-1], True).split('-')
+ value = css_unescape(value[1:-1], True)
else:
- parts = css_unescape(value).split('-')
+ value = css_unescape(value)
+
+ patterns.append(value)
- new_parts = []
- first = True
- for part in parts:
- if part == '*' and first:
- new_parts.append('(?!x\b)[a-z0-9]+?')
- elif part != '*':
- new_parts.append(('' if first else
'(-(?!x\b)[a-z0-9]+)*?\\-') + re.escape(part))
- if first:
- first = False
-
patterns.append(re.compile(r'^{}(?:-.*)?$'.format(''.join(new_parts)), re.I))
sel.lang.append(ct.SelectorLang(patterns))
has_selector = True
@@ -886,6 +879,7 @@
is_indeterminate = bool(flags & FLG_INDETERMINATE)
is_in_range = bool(flags & FLG_IN_RANGE)
is_out_of_range = bool(flags & FLG_OUT_OF_RANGE)
+ is_placeholder_shown = bool(flags & FLG_PLACEHOLDER_SHOWN)
if self.debug: # pragma: no cover
if is_pseudo:
@@ -906,6 +900,8 @@
print(' is_in_range: True')
if is_out_of_range:
print(' is_out_of_range: True')
+ if is_placeholder_shown:
+ print(' is_placeholder_shown: True')
if is_relative:
selectors.append(_Selector())
@@ -1012,6 +1008,8 @@
selectors[-1].flags = ct.SEL_IN_RANGE
if is_out_of_range:
selectors[-1].flags = ct.SEL_OUT_OF_RANGE
+ if is_placeholder_shown:
+ selectors[-1].flags = ct.SEL_PLACEHOLDER_SHOWN
return ct.SelectorList([s.freeze() for s in selectors], is_not,
is_html)
@@ -1074,8 +1072,7 @@
# CSS pattern for `:checked`
CSS_CHECKED = CSSParser(
'''
- html|*:is(input[type=checkbox], input[type=radio])[checked],
- html|select > html|option[selected]
+ html|*:is(input[type=checkbox], input[type=radio])[checked],
html|option[selected]
'''
).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
# CSS pattern for `:default` (must compile CSS_CHECKED first)
@@ -1131,22 +1128,20 @@
# CSS pattern for `:placeholder-shown`
CSS_PLACEHOLDER_SHOWN = CSSParser(
'''
- html|*:is(
- input:is(
- :not([type]),
- [type=""],
- [type=text],
- [type=search],
- [type=url],
- [type=tel],
- [type=email],
- [type=password],
- [type=number]
- ),
- textarea
- )[placeholder][placeholder!='']
+ html|input:is(
+ :not([type]),
+ [type=""],
+ [type=text],
+ [type=search],
+ [type=url],
+ [type=tel],
+ [type=email],
+ [type=password],
+ [type=number]
+ )[placeholder][placeholder!='']:is(:not([value]), [value=""]),
+ html|textarea[placeholder][placeholder!='']
'''
-).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
+).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_PLACEHOLDER_SHOWN)
# CSS pattern default for `:nth-child` "of S" feature
CSS_NTH_OF_S_DEFAULT = CSSParser(
'*|*'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve/css_types.py
new/soupsieve-1.9.5/soupsieve/css_types.py
--- old/soupsieve-1.9.3/soupsieve/css_types.py 2019-08-18 03:04:56.000000000
+0200
+++ new/soupsieve-1.9.5/soupsieve/css_types.py 2019-11-02 15:48:04.000000000
+0100
@@ -26,6 +26,7 @@
SEL_IN_RANGE = 0x80
SEL_OUT_OF_RANGE = 0x100
SEL_DEFINED = 0x200
+SEL_PLACEHOLDER_SHOWN = 0x400
class Immutable(object):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve.egg-info/PKG-INFO
new/soupsieve-1.9.5/soupsieve.egg-info/PKG-INFO
--- old/soupsieve-1.9.3/soupsieve.egg-info/PKG-INFO 2019-08-18
03:06:21.000000000 +0200
+++ new/soupsieve-1.9.5/soupsieve.egg-info/PKG-INFO 2019-11-02
15:48:11.000000000 +0100
@@ -1,12 +1,13 @@
Metadata-Version: 2.1
Name: soupsieve
-Version: 1.9.3
+Version: 1.9.5
Summary: A modern CSS selector implementation for Beautiful Soup.
Home-page: https://github.com/facelessuser/soupsieve
Author: Isaac Muse
Author-email: [email protected]
License: MIT License
-Description: [![Unix Build Status][travis-image]][travis-link]
+Description: [![Build][github-ci-image]][github-ci-link]
+ [![Unix Build Status][travis-image]][travis-link]
[![Windows Build Status][appveyor-image]][appveyor-link]
[![Coverage Status][codecov-image]][codecov-link]
[![PyPI Version][pypi-image]][pypi-link]
@@ -88,12 +89,16 @@
[bs4]: https://beautiful-soup-4.readthedocs.io/en/latest/#
+ [github-ci-image]:
https://github.com/facelessuser/soupsieve/workflows/build/badge.svg
+ [github-ci-link]:
https://github.com/facelessuser/soupsieve/actions?workflow=build
+ [gitter-image]:
https://img.shields.io/gitter/room/facelessuser/soupsieve.svg
+ [gitter-link]: https://gitter.im/facelessuser/soupsieve
[codecov-image]:
https://img.shields.io/codecov/c/github/facelessuser/soupsieve/master.svg
[codecov-link]: https://codecov.io/github/facelessuser/soupsieve
- [travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
- [travis-link]: https://travis-ci.org/facelessuser/soupsieve
[appveyor-image]:
https://img.shields.io/appveyor/ci/facelessuser/soupsieve/master.svg?label=Windows%20Build&logo=appveyor
[appveyor-link]: https://ci.appveyor.com/project/facelessuser/soupsieve
+ [travis-image]:
https://img.shields.io/travis/facelessuser/soupsieve/master.svg?label=Unix%20Build&logo=travis
+ [travis-link]: https://travis-ci.org/facelessuser/soupsieve
[pypi-image]:
https://img.shields.io/pypi/v/soupsieve.svg?logo=python&logoColor=white
[pypi-link]: https://pypi.python.org/pypi/soupsieve
[license-image-mit]: https://img.shields.io/badge/license-MIT-blue.svg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/soupsieve.egg-info/SOURCES.txt
new/soupsieve-1.9.5/soupsieve.egg-info/SOURCES.txt
--- old/soupsieve-1.9.3/soupsieve.egg-info/SOURCES.txt 2019-08-18
03:06:21.000000000 +0200
+++ new/soupsieve-1.9.5/soupsieve.egg-info/SOURCES.txt 2019-11-02
15:48:11.000000000 +0100
@@ -19,7 +19,7 @@
docs/theme/extra-0b9b22dd13.js
docs/theme/extra-30d8e6755c.css
requirements/docs.txt
-requirements/flake8.txt
+requirements/lint.txt
requirements/project.txt
requirements/tests.txt
requirements/tools.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/tests/test_level3/test_disabled.py
new/soupsieve-1.9.5/tests/test_level3/test_disabled.py
--- old/soupsieve-1.9.3/tests/test_level3/test_disabled.py 2019-08-18
03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/tests/test_level3/test_disabled.py 2019-11-02
15:48:04.000000000 +0100
@@ -143,3 +143,20 @@
['4', '5', '6', '7', '8', '9', 'a', 'c'],
flags=util.PYHTML
)
+
+ def test_disabled_with_nested_optgroup(self):
+ """Test `:disabled` only selects `option` elements whose closest
`optgroup` parent is disabled."""
+
+ self.assert_selector(
+ """
+ <optgroup id="0" disabled>
+ <option id="1"></option>
+ <optgroup id="3">
+ <option id="4"></option>
+ </optgroup>
+ </optgroup>
+ """,
+ ":disabled",
+ ['0', '1'],
+ flags=util.HTML
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/tests/test_level4/test_lang.py
new/soupsieve-1.9.5/tests/test_level4/test_lang.py
--- old/soupsieve-1.9.3/tests/test_level4/test_lang.py 2019-08-18
03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/tests/test_level4/test_lang.py 2019-11-02
15:48:04.000000000 +0100
@@ -23,6 +23,16 @@
<p id="5"></p>
</div>
<p id="6" lang="de-DE"></p>
+ <div lang="a-DE">
+ <p id="7"></p>
+ </div>
+ <!-- Singletons don't match implicit wildcards (* not at start are ignored
and treated as implicit) -->
+ <div lang="a-a-DE">
+ <p id="8"></p>
+ </div>
+ <div lang="en-a-DE">
+ <p id="9"></p>
+ </div>
"""
def test_lang(self):
@@ -36,6 +46,17 @@
flags=util.HTML
)
+ def test_lang_missing_range(self):
+ """Test language range with a missing range."""
+
+ # Implicit wild
+ self.assert_selector(
+ self.MARKUP,
+ "p:lang(de--DE)",
+ [],
+ flags=util.HTML
+ )
+
def test_explicit_wildcard(self):
"""Test language with explicit wildcard (same as implicit)."""
@@ -47,6 +68,36 @@
flags=util.HTML
)
+ def test_only_wildcard(self):
+ """Test language with only a wildcard."""
+
+ self.assert_selector(
+ self.MARKUP,
+ "p:lang('*')",
+ ['1', '2', '3', '4', '5', '6', '7', '8', '9'],
+ flags=util.HTML
+ )
+
+ def test_wildcard_start_no_match(self):
+ """Test language with a wildcard at start, but it matches nothing."""
+
+ self.assert_selector(
+ self.MARKUP,
+ "p:lang('*-de-DE')",
+ [],
+ flags=util.HTML
+ )
+
+ def test_wildcard_start_collapse(self):
+ """Test that language with multiple wildcard patterns at start
collapse."""
+
+ self.assert_selector(
+ self.MARKUP,
+ "p:lang('*-*-*-DE')",
+ ['1', '2', '3', '4', '5', '6', '7'],
+ flags=util.HTML
+ )
+
def test_wildcard_at_start_escaped(self):
"""
Test language with wildcard at start (escaped).
@@ -57,7 +108,7 @@
self.assert_selector(
self.MARKUP,
"p:lang(\\*-DE)",
- ['1', '2', '3', '4', '5', '6'],
+ ['1', '2', '3', '4', '5', '6', '7'],
flags=util.HTML
)
@@ -90,7 +141,7 @@
self.assert_selector(
self.MARKUP,
"p:lang('*-DE')",
- ['1', '2', '3', '4', '5', '6'],
+ ['1', '2', '3', '4', '5', '6', '7'],
flags=util.HTML
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/soupsieve-1.9.3/tests/test_level4/test_placeholder_shown.py
new/soupsieve-1.9.5/tests/test_level4/test_placeholder_shown.py
--- old/soupsieve-1.9.3/tests/test_level4/test_placeholder_shown.py
2019-08-18 03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/tests/test_level4/test_placeholder_shown.py
2019-11-02 15:48:04.000000000 +0100
@@ -10,12 +10,15 @@
"""Test placeholder shown."""
markup = """
+ /* These have a placeholder. */
<input id="0" placeholder="This is some text">
<textarea id="1" placeholder="This is some text"></textarea>
+ /* These do not have a placeholder. */
<input id="2" placeholder="">
<input id="3">
+ /* All types that should register has having a placeholder. */
<input id="4" type="email" placeholder="This is some text">
<input id="5" type="number" placeholder="This is some text">
<input id="6" type="password" placeholder="This is some text">
@@ -26,6 +29,7 @@
<input id="11" type="" placeholder="This is some text">
<input id="12" type placeholder="This is some text">
+ /* Types that should not register has having a placeholder. */
<input id="13" type="button" placeholder="This is some text">
<input id="14" type="checkbox" placeholder="This is some text">
<input id="15" type="color" placeholder="This is some text">
@@ -41,11 +45,28 @@
<input id="25" type="submit" placeholder="This is some text">
<input id="26" type="time" placeholder="This is some text">
<input id="27" type="week" placeholder="This is some text">
+
+ /* Value will not override this instance as value is empty. */
+ <input id="28" type placeholder="This is some text" value="">
+
+ /* Value will override this input */
+ <input id="29" type placeholder="This is some text" value="Actual
value">
+
+ /* Text area content overides the placeholder
+ <textarea id="30" placeholder="This is some text">Value</textarea>
+ <textarea id="31" placeholder="This is some text">
+
+
+ </textarea>
+
+ /* Text area is still considered empty with a single new line (does
not include carriage return). */
+ <textarea id="32" placeholder="This is some text">
+ </textarea>
"""
self.assert_selector(
markup,
":placeholder-shown",
- ['0', '1', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
+ ['0', '1', '4', '5', '6', '7', '8', '9', '10', '11', '12', '28',
'32'],
flags=util.HTML
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/soupsieve-1.9.3/tox.ini new/soupsieve-1.9.5/tox.ini
--- old/soupsieve-1.9.3/tox.ini 2019-08-18 03:04:56.000000000 +0200
+++ new/soupsieve-1.9.5/tox.ini 2019-11-02 15:48:04.000000000 +0100
@@ -24,7 +24,7 @@
passenv = *
deps =
-rrequirements/project.txt
- -rrequirements/flake8.txt
+ -rrequirements/lint.txt
commands =
flake8 {toxinidir}