Skip to content

Commit d0e5402

Browse files
authored
Various :dir fixes (#347)
* Various `:dir` fixes - `:dir()` now uses the value of an `input` with `dir="auto"` when `type` is `hidden`, `password`, `submit`, `reset`, or `button`, as the HTML specification does. - `dir="auto"` and `bdi` now analyze the text of non-HTML elements, such as SVG and MathML, and only ignore HTML elements such as `script`, `style`, and `bdi`. The text directly in an `iframe` is analyzed as well, and the contents of a `template`, which are not part of the document, are not. - `:dir()` now matches a `bdi` element that is the root by its text instead of assuming left to right. - `:dir()` now treats any element without a parent element as left to right, not just the root. Before, all but the first top level element of a fragment parsed with `html.parser` never matched. - `:dir()` now accepts any identifier, as CSS requires, including escaped ones. Values other than `ltr` and `rtl` do not match anything. * Avoid `template` in `:dir()` * Use Unicode 18 bidi table * Restrict test to only HTML5Lib
1 parent b7bc7d7 commit d0e5402

8 files changed

Lines changed: 690 additions & 83 deletions

File tree

‎docs/src/markdown/about/changelog.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ icon: lucide/scroll-text
2222
parent (the `dir` attribute only applies to HTML elements), and HTML elements inside them, such as in an SVG
2323
`foreignObject`, by the direction of their ancestors.
2424
- **FIX**: Fix `:dir()` ignoring the value of an `input` with `dir="auto"` and a missing or empty `type`.
25+
- **FIX**: `:dir()` now uses a table generated from Unicode 18 instead of `unicodedata`, so results no longer depend
26+
on the Unicode version of the Python in use, and unassigned code points use their default direction.
27+
- **FIX**: `:dir()` now uses the value of an `input` with `dir="auto"` when `type` is `hidden`, `password`, `submit`,
28+
`reset`, or `button`, as the HTML specification does.
29+
- **FIX**: `dir="auto"` and `bdi` now analyze the text of non-HTML elements, such as SVG and MathML, and only ignore
30+
HTML elements such as `script`, `style`, and `bdi`. The text directly in an `iframe` is analyzed as well, and the
31+
contents of a `template`, which are not part of the document, are not.
32+
- **FIX**: `:dir()` no longer lets the contents of a `template` inherit direction from the `template` or its
33+
ancestors, as they are not part of the document. They are left to right unless they specify otherwise.
34+
- **FIX**: `:dir()` now matches a `bdi` element that is the root by its text instead of assuming left to right.
35+
- **FIX**: `:dir()` now treats any element without a parent element as left to right, not just the root. Before,
36+
all but the first top level element of a fragment parsed with `html.parser` never matched.
37+
- **FIX**: `:dir()` now accepts any identifier, as CSS requires, including escaped ones. Values other than `ltr` and
38+
`rtl` do not match anything.
2539
- **FIX**: Fix `:lang()` treating an element with an empty `lang` or `xml:lang` attribute as having the language of
2640
a tagged ancestor.
2741
- **FIX**: Cache forms without a default button when matching `:default` to avoid quadratic time on forms with

‎docs/src/markdown/about/development.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ $ coverage erase
100100
Then run each unit test environment to and coverage will be calculated. All the data from each run is merged together.
101101
HTML is output for each file in `.cov`. You can use these to see areas that are not covered/exercised yet with testing.
102102

103+
## Updating Unicode Data
104+
105+
`:dir()` finds the direction of text with `soupsieve/bidi.py`, a table generated from the Unicode Character Database so
106+
that results do not depend on the Unicode version of the Python in use. To update to a new Unicode version, generate the
107+
table again, providing the version or omitting it for the latest. Unicode 15.0 is the earliest version supported.
108+
109+
```console
110+
$ python tools/gen_bidi.py 18.0.0
111+
```
112+
103113
## Code Documentation
104114

105115
The Soup Sieve module is laid out in the following structure:

‎docs/src/markdown/selectors/pseudo-classes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ soup.select('body > *:defined')
176176
## `#!css :dir()`:material-language-html5:{: title="HTML" data-md-color-primary="orange" .icon} {:#:dir}
177177

178178
Selects elements based on text directionality. Accepts either `ltr` or `rtl` for "left to right" and "right to left"
179-
respectively.
179+
respectively. Any other identifier is valid, but will not match anything.
180180

181181
/// tab | Syntax
182182
```css

‎soupsieve/bidi.py‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
"""
2+
Bidirectional text data for Unicode 18.0.0.
3+
4+
Generated by `tools/gen_bidi.py`, do not edit.
5+
"""
6+
7+
UNICODE_VERSION = '18.0.0'
8+
9+
# Each code point begins a run of characters that have the same direction.
10+
STARTS: tuple[int, ...] = (
11+
0x0000, 0x0041, 0x005B, 0x0061, 0x007B, 0x00AA, 0x00AB, 0x00B5, 0x00B6, 0x00BA, 0x00BB, 0x00C0, 0x00D7, 0x00D8,
12+
0x00F7, 0x00F8, 0x02B9, 0x02BB, 0x02C2, 0x02D0, 0x02D2, 0x02E0, 0x02E5, 0x02EE, 0x02EF, 0x0370, 0x0374, 0x0376,
13+
0x037E, 0x037F, 0x0384, 0x0386, 0x0387, 0x0388, 0x03F6, 0x03F7, 0x0483, 0x048A, 0x058A, 0x058B, 0x058D, 0x0590,
14+
0x0591, 0x05BE, 0x05BF, 0x05C0, 0x05C1, 0x05C3, 0x05C4, 0x05C6, 0x05C7, 0x05CA, 0x0600, 0x0608, 0x0609, 0x060B,
15+
0x060C, 0x060D, 0x060E, 0x061B, 0x064B, 0x066D, 0x0670, 0x0671, 0x06D6, 0x06E5, 0x06E7, 0x06EE, 0x06F0, 0x06FA,
16+
0x0711, 0x0712, 0x0730, 0x074B, 0x07A6, 0x07B1, 0x07EB, 0x07F4, 0x07F6, 0x07FA, 0x07FD, 0x07FE, 0x0816, 0x081A,
17+
0x081B, 0x0824, 0x0825, 0x0828, 0x0829, 0x082E, 0x0859, 0x085C, 0x0890, 0x0892, 0x0897, 0x08A0, 0x08CA, 0x0903,
18+
0x093A, 0x093B, 0x093C, 0x093D, 0x0941, 0x0949, 0x094D, 0x094E, 0x0951, 0x0958, 0x0962, 0x0964, 0x0981, 0x0982,
19+
0x09BC, 0x09BD, 0x09C1, 0x09C5, 0x09CD, 0x09CE, 0x09E2, 0x09E4, 0x09F2, 0x09F4, 0x09FB, 0x09FC, 0x09FE, 0x09FF,
20+
0x0A01, 0x0A03, 0x0A3C, 0x0A3D, 0x0A41, 0x0A43, 0x0A47, 0x0A49, 0x0A4B, 0x0A4E, 0x0A51, 0x0A52, 0x0A70, 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085, 0x1087, 0x108D, 0x108E, 0x109D, 0x109E,
31+
0x135D, 0x1360, 0x1390, 0x139A, 0x1400, 0x1401, 0x1680, 0x1681, 0x169B, 0x169D, 0x1712, 0x1715, 0x1732, 0x1734,
32+
0x1752, 0x1754, 0x1772, 0x1774, 0x17B4, 0x17B6, 0x17B7, 0x17BE, 0x17C6, 0x17C7, 0x17C9, 0x17D4, 0x17DB, 0x17DC,
33+
0x17DD, 0x17DE, 0x17F0, 0x17FA, 0x1800, 0x1810, 0x1885, 0x1887, 0x18A9, 0x18AA, 0x1920, 0x1923, 0x1927, 0x1929,
34+
0x1932, 0x1933, 0x1939, 0x193C, 0x1940, 0x1941, 0x1944, 0x1946, 0x19DE, 0x1A00, 0x1A17, 0x1A19, 0x1A1B, 0x1A1C,
35+
0x1A56, 0x1A57, 0x1A58, 0x1A5F, 0x1A60, 0x1A61, 0x1A62, 0x1A63, 0x1A65, 0x1A6D, 0x1A73, 0x1A7D, 0x1A7F, 0x1A80,
36+
0x1AB0, 0x1AF1, 0x1B00, 0x1B04, 0x1B34, 0x1B35, 0x1B36, 0x1B3A, 0x1B6B, 0x1B74, 0x1B80, 0x1B82, 0x1BA2, 0x1BA6,
37+
0x1BA8, 0x1BAA, 0x1BAB, 0x1BAE, 0x1BE6, 0x1BE7, 0x1BE8, 0x1BEA, 0x1BED, 0x1BEE, 0x1BEF, 0x1BF2, 0x1C2C, 0x1C34,
38+
0x1C36, 0x1C38, 0x1CD0, 0x1CD3, 0x1CD4, 0x1CE1, 0x1CE2, 0x1CE9, 0x1CED, 0x1CEE, 0x1CF4, 0x1CF5, 0x1CF8, 0x1CFA,
39+
0x1DC0, 0x1E00, 0x1FBD, 0x1FBE, 0x1FBF, 0x1FC2, 0x1FCD, 0x1FD0, 0x1FDD, 0x1FE0, 0x1FED, 0x1FF0, 0x1FFD, 0x1FFF,
40+
0x2000, 0x200E, 0x200F, 0x2010, 0x2071, 0x2074, 0x207F, 0x2080, 0x2090, 0x20A0, 0x20F1, 0x2100, 0x2102, 0x2103,
41+
0x2107, 0x2108, 0x210A, 0x2114, 0x2115, 0x2116, 0x2119, 0x211E, 0x2124, 0x2125, 0x2126, 0x2127, 0x2128, 0x2129,
42+
0x212A, 0x212E, 0x212F, 0x213A, 0x213C, 0x2140, 0x2145, 0x214A, 0x214E, 0x2150, 0x2160, 0x2189, 0x218C, 0x2190,
43+
0x2336, 0x237B, 0x2395, 0x2396, 0x242A, 0x2440, 0x244B, 0x2460, 0x249C, 0x24EA, 0x26AC, 0x26AD, 0x2800, 0x2900,
44+
0x2B74, 0x2B76, 0x2C00, 0x2CE5, 0x2CEB, 0x2CEF, 0x2CF2, 0x2CF9, 0x2D00, 0x2D7F, 0x2D80, 0x2DE0, 0x2E5E, 0x2E60,
45+
0x2E64, 0x2E80, 0x2E9A, 0x2E9B, 0x2EF4, 0x2F00, 0x2FD6, 0x2FF0, 0x3005, 0x3008, 0x3021, 0x302A, 0x302E, 0x3030,
46+
0x3031, 0x3036, 0x3038, 0x303D, 0x3040, 0x3099, 0x309D, 0x30A0, 0x30A1, 0x30FB, 0x30FC, 0x31C0, 0x31E6, 0x31EF,
47+
0x31F0, 0x321D, 0x321F, 0x3250, 0x3260, 0x327C, 0x327F, 0x32B1, 0x32C0, 0x32CC, 0x32D0, 0x3377, 0x337B, 0x33DE,
48+
0x33E0, 0x33FF, 0x3400, 0x4DC0, 0x4E00, 0xA490, 0xA4C7, 0xA60D, 0xA610, 0xA66F, 0xA680, 0xA69E, 0xA6A0, 0xA6F0,
49+
0xA6F2, 0xA700, 0xA722, 0xA788, 0xA789, 0xA802, 0xA803, 0xA806, 0xA807, 0xA80B, 0xA80C, 0xA825, 0xA827, 0xA828,
50+
0xA82D, 0xA838, 0xA83A, 0xA874, 0xA878, 0xA8C4, 0xA8C6, 0xA8E0, 0xA8F2, 0xA8FF, 0xA900, 0xA926, 0xA92E, 0xA947,
51+
0xA952, 0xA980, 0xA983, 0xA9B3, 0xA9B4, 0xA9B6, 0xA9BA, 0xA9BC, 0xA9BE, 0xA9E5, 0xA9E6, 0xAA29, 0xAA2F, 0xAA31,
52+
0xAA33, 0xAA35, 0xAA37, 0xAA43, 0xAA44, 0xAA4C, 0xAA4D, 0xAA7C, 0xAA7D, 0xAAB0, 0xAAB1, 0xAAB2, 0xAAB5, 0xAAB7,
53+
0xAAB9, 0xAABE, 0xAAC0, 0xAAC1, 0xAAC2, 0xAAEC, 0xAAEE, 0xAAF6, 0xAAF7, 0xAB6A, 0xAB6C, 0xABE5, 0xABE6, 0xABE8,
54+
0xABE9, 0xABED, 0xABEE, 0xFB1D, 0xFB1E, 0xFB1F, 0xFB29, 0xFB2A, 0xFBC3, 0xFBD3, 0xFD3E, 0xFD50, 0xFD90, 0xFD92,
55+
0xFDC8, 0xFDF0, 0xFDFD, 0xFE1A, 0xFE20, 0xFE53, 0xFE54, 0xFE67, 0xFE68, 0xFE6C, 0xFE70, 0xFEFF, 0xFF00, 0xFF01,
56+
0xFF21, 0xFF3B, 0xFF41, 0xFF5B, 0xFF66, 0xFFE0, 0xFFE7, 0xFFE8, 0xFFEF, 0xFFF0, 0x10000, 0x10101, 0x10102, 0x10140,
57+
0x1018D, 0x10190, 0x1019D, 0x101A0, 0x101A1, 0x101FD, 0x101FE, 0x102E0, 0x102FC, 0x10376, 0x1037B, 0x10800, 0x1091F,
58+
0x10920, 0x10A01, 0x10A04, 0x10A05, 0x10A07, 0x10A0C, 0x10A10, 0x10A38, 0x10A3B, 0x10A3F, 0x10A40, 0x10AE5, 0x10AE7,
59+
0x10B39, 0x10B40, 0x10D24, 0x10D28, 0x10D30, 0x10D3A, 0x10D40, 0x10D4A, 0x10D69, 0x10D6F, 0x10E60, 0x10E7F, 0x10EAB,
60+
0x10EAD, 0x10ECB, 0x10ED9, 0x10EF0, 0x10F00, 0x10F46, 0x10F51, 0x10F82, 0x10F86, 0x11000, 0x11001, 0x11002, 0x11038,
61+
0x11047, 0x11052, 0x11066, 0x11070, 0x11071, 0x11073, 0x11075, 0x1107F, 0x11082, 0x110B3, 0x110B7, 0x110B9, 0x110BB,
62+
0x110C2, 0x110C3, 0x11100, 0x11103, 0x11127, 0x1112C, 0x1112D, 0x11135, 0x11173, 0x11174, 0x11180, 0x11182, 0x111B6,
63+
0x111BF, 0x111C9, 0x111CD, 0x111CF, 0x111D0, 0x1122F, 0x11232, 0x11234, 0x11235, 0x11236, 0x11238, 0x1123E, 0x1123F,
64+
0x11241, 0x11242, 0x112DF, 0x112E0, 0x112E3, 0x112EB, 0x11300, 0x11302, 0x1133B, 0x1133D, 0x11340, 0x11341, 0x11366,
65+
0x1136D, 0x11370, 0x11375, 0x113BB, 0x113C1, 0x113CE, 0x113CF, 0x113D0, 0x113D1, 0x113D2, 0x113D3, 0x113E1, 0x113E3,
66+
0x11438, 0x11440, 0x11442, 0x11445, 0x11446, 0x11447, 0x1145E, 0x1145F, 0x114B3, 0x114B9, 0x114BA, 0x114BB, 0x114BF,
67+
0x114C1, 0x114C2, 0x114C4, 0x115B2, 0x115B6, 0x115BC, 0x115BE, 0x115BF, 0x115C1, 0x115DC, 0x115DE, 0x11633, 0x1163B,
68+
0x1163D, 0x1163E, 0x1163F, 0x11641, 0x11660, 0x1166D, 0x116AB, 0x116AC, 0x116AD, 0x116AE, 0x116B0, 0x116B6, 0x116B7,
69+
0x116B8, 0x1171D, 0x1171E, 0x1171F, 0x11720, 0x11722, 0x11726, 0x11727, 0x1172C, 0x1182F, 0x11838, 0x11839, 0x1183B,
70+
0x1193B, 0x1193D, 0x1193E, 0x1193F, 0x11943, 0x11944, 0x119D4, 0x119D8, 0x119DA, 0x119DC, 0x119E0, 0x119E1, 0x11A01,
71+
0x11A07, 0x11A09, 0x11A0B, 0x11A33, 0x11A39, 0x11A3B, 0x11A3F, 0x11A47, 0x11A48, 0x11A51, 0x11A57, 0x11A59, 0x11A5C,
72+
0x11A8A, 0x11A97, 0x11A98, 0x11A9A, 0x11B60, 0x11B61, 0x11B62, 0x11B65, 0x11B66, 0x11B67, 0x11C30, 0x11C37, 0x11C38,
73+
0x11C3E, 0x11C92, 0x11CA8, 0x11CAA, 0x11CB1, 0x11CB2, 0x11CB4, 0x11CB5, 0x11CB7, 0x11D31, 0x11D37, 0x11D3A, 0x11D3B,
74+
0x11D3C, 0x11D3E, 0x11D3F, 0x11D46, 0x11D47, 0x11D48, 0x11D90, 0x11D92, 0x11D95, 0x11D96, 0x11D97, 0x11D98, 0x11DF0,
75+
0x11DF1, 0x11EF3, 0x11EF5, 0x11F00, 0x11F02, 0x11F36, 0x11F3B, 0x11F40, 0x11F41, 0x11F42, 0x11F43, 0x11F5A, 0x11F5B,
76+
0x11FD5, 0x11FF2, 0x13440, 0x13441, 0x13447, 0x13456, 0x1611E, 0x1612A, 0x1612D, 0x16130, 0x16AF0, 0x16AF5, 0x16B30,
77+
0x16B37, 0x16F4F, 0x16F50, 0x16F8F, 0x16F93, 0x16FE2, 0x16FE3, 0x16FE4, 0x16FE5, 0x1BC9D, 0x1BC9F, 0x1BCA0, 0x1BCA4,
78+
0x1CC00, 0x1CCD6, 0x1CCF0, 0x1CCFD, 0x1CD00, 0x1CEB4, 0x1CEBA, 0x1CED1, 0x1CED2, 0x1CED5, 0x1CEDD, 0x1CEFE, 0x1CF00,
79+
0x1CF2E, 0x1CF30, 0x1CF47, 0x1D127, 0x1D129, 0x1D167, 0x1D16A, 0x1D173, 0x1D183, 0x1D185, 0x1D18C, 0x1D1AA, 0x1D1AE,
80+
0x1D1E9, 0x1D1EB, 0x1D200, 0x1D246, 0x1D25B, 0x1D25D, 0x1D300, 0x1D357, 0x1D6C1, 0x1D6C2, 0x1D6DB, 0x1D6DC, 0x1D6FB,
81+
0x1D6FC, 0x1D715, 0x1D716, 0x1D735, 0x1D736, 0x1D74F, 0x1D750, 0x1D76F, 0x1D770, 0x1D789, 0x1D78A, 0x1D7A9, 0x1D7AA,
82+
0x1D7C3, 0x1D7C4, 0x1D7CE, 0x1D800, 0x1DA00, 0x1DA37, 0x1DA3B, 0x1DA6D, 0x1D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FFFE,
92+
0x30000, 0x3FFFE, 0x40000, 0x4FFFE, 0x50000, 0x5FFFE, 0x60000, 0x6FFFE, 0x70000, 0x7FFFE, 0x80000, 0x8FFFE, 0x90000,
93+
0x9FFFE, 0xA0000, 0xAFFFE, 0xB0000, 0xBFFFE, 0xC0000, 0xCFFFE, 0xD0000, 0xDFFFE, 0xE1000, 0xEFFFE, 0xF0000, 0xFFFFE,
94+
0x100000, 0x10FFFE,
95+
)
96+
97+
# The direction of each run: `L` is left to right, `R` is right to left, and `N` is not a strong direction.
98+
DIRECTIONS = (
99+
'NLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNLNLNLNLNLNLNLNLNL'
100+
'NLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNL'
101+
'NLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNL'
102+
'NLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLRNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLN'
103+
'LNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLN'
104+
'LNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLNLRNRNRNRNRNRNRNLNLNLNLRNLNLNLNLNLNLNLNLNLNLNLNLNLNLRNRNRNRNRNRNRNRNRNRNRNRNRNRNR'
105+
'NRNRNRN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