Comments (2)
Reading the HTML5 spec, below is my current understanding. I am confused by [detect 2].
Is ltr
- Check
dir
attribute is inltr
state. - If document element and
dir
is not defined or invalid. input
element and intelephone
state anddir
is not in a defined or invalid.
Is rtl
dir
is set tortl
Detect 1
- If
input
type oftext
,search
,telephone
,URL
, oremail
and set toauto
. - If element is a
textarea
and the dir attribute is in theauto
state.
Check value for first character that is of bidirectioal AL
or R
with no bidi type of L
before it. Then it is rtl
If element value is not empty string or it is the document element, then it is ltr
.
Otherwise, directionality is inherited by parent.
Detect 2
- Element's
dir
is set toauto
- Element is a
bdi
element with no validdir
.
Check that text node is a descendant of the element, but does not have an ancestor element that is a descendant of the element (so direct child node?). Check first character that has bidi type of L
, AL
, or R
, if found. Or if document element, it's ltr
. Lastly, just inherit.
This is hard to understand. There appears to be some additional stipulations, but man is this poorly written:
The character is not in a Text node that has an ancestor element that is
a descendant of the element whose directionality is being determined and
that is either:
- A bdi element.
- A script element.
- A style element.
- A textarea element.
- An element with a dir attribute in a defined state.
Inherit
- Element has a parent and the
dir
attribute is not in a defined state.
Inherit parent (document element is assumed ltr
).
from soupsieve.
Alright, the part I was confused about makes sense now. In detect 2, the next node cannot be in a descendant that is a bdi
, script
, style
, textarea
, or an element with a defined dir
attribute state. This is doable, complicated, but doable. I think I have most of it coded up now.
EDIT: For HTML only right now.
from soupsieve.
Related Issues (20)
- CDATA handling in HTML changed in lxml parser with libxml2 2.9.12 HOT 21
- Interesting psuedo class to keep an eye on `:in()` HOT 8
- Rework internal structure of "relations" HOT 1
- circular dependency /bs4 HOT 15
- Attribute selectors vs \n in values HOT 5
- Change in `:has()` CSS Level 4 spec - document our difference or update? HOT 1
- hatch? HOT 5
- Using Hatch in Python 3.6 is technically not allowed HOT 7
- setup.py is mentioned in readme but there is no setup.py HOT 2
- Invalid syntax error on python3.4 HOT 5
- Tracking `:scope` issue related to relative selector lists (`:has()`) HOT 1
- pyproject.toml: validation error since setuptools 61.2.0 HOT 8
- PermissionError: [Errno 13] Permission denied HOT 4
- missing dependency on `bs4` HOT 7
- LXML does not currently generate wheels for Python 3.11 on Windows
- `:has()` is no longer forgiving HOT 1
- malformed attribute selector HOT 7
- The new type hints cause pytest to hang after test session HOT 4
- Attribute Selector Case Sensitivity: Whitespace HOT 1
- Potentially rework CSS parsing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from soupsieve.