css-has-pseudo 5.0.2 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,154 +1,23 @@
1
1
  # Changes to CSS Has Pseudo
2
2
 
3
- ### 5.0.2 (February 6, 2023)
3
+ ### 6.0.1
4
4
 
5
- - Reduce the amount of duplicate fallback CSS.
6
-
7
- ### 5.0.1 (January 28, 2023)
8
-
9
- - Improve `types` declaration in `package.json`
10
-
11
- ### 5.0.0 (January 24, 2023)
12
-
13
- - Updated: Support for Node v14+ (major).
14
- - Fix: Do not throw when a selector is invalid, show a warning instead.
15
- - Fix: make `:has()` unforgiving. `:has(.foo, :some-invalid-selector)` will no longer match elements that have children with `.foo`.
16
-
17
- ### 4.0.2 (December 12, 2022)
18
-
19
- - Fix: correctly cleanup style rules when a browser has native support. [backported](https://github.com/csstools/postcss-plugins/pull/752)
20
-
21
- ### 4.0.1 (August 23, 2022)
22
-
23
- - Fix: assign global browser polyfill to `window`, `self` or a blank object.
24
-
25
- ### 4.0.0 (July 8, 2022)
26
-
27
- [Read the full changelog](https://github.com/csstools/postcss-plugins/wiki/PostCSS-Preset-Env-8)
28
-
29
- - Breaking: removed old CDN urls
30
- - Added: 'hover' options for browser polyfill
31
- - Added: 'observedAttributes' options for browser polyfill
32
- - Added: 'forcePolyfill' options for browser polyfill
33
- - Added: Rules within `@supports selector(:has(something))` won't be transformed.
34
- - Fix: Use base36 encoding to support all possible selectors.
35
- - Fix: case insensitive matching.
36
-
37
- #### How to migrate :
38
-
39
- ##### Re-build your CSS with the new version of the library.
40
-
41
- ##### If you use a CDN url, please update it.
42
-
43
- ```diff
44
- - <script src="https://unpkg.com/css-has-pseudo/browser"></script>
45
- + <script src="https://unpkg.com/css-has-pseudo/dist/browser-global.js"></script>
46
- ```
47
-
48
- ```diff
49
- - <script src="https://unpkg.com/css-has-pseudo/browser.min"></script>
50
- + <script src="https://unpkg.com/css-has-pseudo/dist/browser-global.js"></script>
51
- ```
52
-
53
- ### 3.0.4 (February 5, 2022)
54
-
55
- - Rebuild of browser polyfills
56
-
57
- ### 3.0.3 (January 12, 2022)
58
-
59
- - Fix compatibility with PostCSS `v8.2.x` [#147](https://github.com/csstools/postcss-plugins/issues/147)
60
-
61
- This version is not officially supported but some tool providers pinned PostCSS to `v8.2.x`,
62
- making it impossible for end users to have a working setup.
63
-
64
- ### 3.0.2 (January 2, 2022)
65
-
66
- - Removed Sourcemaps from package tarball.
67
- - Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121).
68
-
69
- ### 3.0.1 (December 27, 2021)
70
-
71
- - Fixed: require/import paths for browser script
5
+ _December 15, 2023_
72
6
 
73
- ### 3.0.0 (December 13, 2021)
7
+ - Fix type definitions
8
+ - Updated [`@csstools/selector-specificity`](https://github.com/csstools/postcss-plugins/tree/main/packages/selector-specificity) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/selector-specificity/CHANGELOG.md#301) (patch)
74
9
 
75
- - Breaking: require/import paths have changed
76
- - Changed: new polyfill CDN urls.
77
- - Updated: documentation
10
+ ### 6.0.0
78
11
 
79
- **Migrating to 3.0.0**
12
+ _July 3, 2023_
80
13
 
81
- PostCSS plugin :
14
+ - Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
15
+ - Updated [`@csstools/selector-specificity`](https://github.com/csstools/postcss-plugins/tree/main/packages/selector-specificity) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/selector-specificity/CHANGELOG.md#300) (major)
82
16
 
83
- ```diff
84
- - const postcssHasPseudo = require('css-has-pseudo/postcss');
85
- + const postcssHasPseudo = require('css-has-pseudo');
86
- ```
17
+ ### 5.0.2
87
18
 
88
- Browser Polyfill :
19
+ _February 6, 2023_
89
20
 
90
- ```diff
91
- - const cssHasPseudo = require('css-has-pseudo');
92
- + const cssHasPseudo = require('css-has-pseudo/browser');
93
- ```
94
-
95
- _The old CND url is now deprecated and will be removed in a next major release._
96
- _It will continue to work for now._
97
-
98
- ```diff
99
- - <script src="https://unpkg.com/css-has-pseudo/browser"></script>
100
- + <script src="https://unpkg.com/css-has-pseudo/dist/browser-global.js"></script>
101
- ```
102
-
103
- ### 2.0.0 (September 16, 2021)
104
-
105
- - Updated: Support for PostCS 8+ (major).
106
- - Updated: Support for Node 12+ (major).
107
-
108
- ### 1.0.0 (June 10, 2019)
109
-
110
- - Updated: `postcss-selector-parser` to 6.0.2 (major)
111
- - Updated: `postcss` to 7.0.16 (patch)
112
- - Updated: Node 8+ compatibility (major)
113
-
114
- ### 0.10.0 (December 11, 2018)
115
-
116
- - Fixed an issue where inaccessible rules would crash the library
117
-
118
- ### 0.9.0 (November 26, 2018)
119
-
120
- - Improved CLI usage
121
-
122
- ### 0.8.0 (November 26, 2018)
123
-
124
- - Fixed an issue where attribute names were not being properly encoded
125
-
126
- ### 0.7.0 (November 25, 2018)
127
-
128
- - Replaced `setImmediate` with `requestAnimationFrame` for future compatibility
129
-
130
- ### 0.6.0 (November 25, 2018)
131
-
132
- - Fixed an issue where nested rules were not supported
133
-
134
- ### 0.5.0 (November 21, 2018)
135
-
136
- - Further optimize script; from 775 bytes to 757 bytes
137
-
138
- ### 0.4.0 (November 21, 2018)
139
-
140
- - Fixed an issue with the browser script not picking up added nodes
141
-
142
- ### 0.3.0 (November 21, 2018)
143
-
144
- - Fixed the misnamed function name for the browser-ready script
145
-
146
- ### 0.2.0 (November 21, 2018)
147
-
148
- - Improved browser compatibility with updated parsers, encoders, and decoders
149
- - Improved performance by walking the DOM less
150
- - Reduced script size by 9%; from 855 bytes to 775 bytes
151
-
152
- ### 0.1.0 (November 20, 2018)
21
+ - Reduce the amount of duplicate fallback CSS.
153
22
 
154
- - Initial version
23
+ [Full CHANGELOG](https://github.com/csstools/postcss-plugins/tree/main/plugins/css-has-pseudo/CHANGELOG.md)
package/LICENSE.md CHANGED
@@ -1,108 +1,18 @@
1
- # CC0 1.0 Universal
2
-
3
- ## Statement of Purpose
4
-
5
- The laws of most jurisdictions throughout the world automatically confer
6
- exclusive Copyright and Related Rights (defined below) upon the creator and
7
- subsequent owner(s) (each and all, an “owner”) of an original work of
8
- authorship and/or a database (each, a “Work”).
9
-
10
- Certain owners wish to permanently relinquish those rights to a Work for the
11
- purpose of contributing to a commons of creative, cultural and scientific works
12
- (“Commons”) that the public can reliably and without fear of later claims of
13
- infringement build upon, modify, incorporate in other works, reuse and
14
- redistribute as freely as possible in any form whatsoever and for any purposes,
15
- including without limitation commercial purposes. These owners may contribute
16
- to the Commons to promote the ideal of a free culture and the further
17
- production of creative, cultural and scientific works, or to gain reputation or
18
- greater distribution for their Work in part through the use and efforts of
19
- others.
20
-
21
- For these and/or other purposes and motivations, and without any expectation of
22
- additional consideration or compensation, the person associating CC0 with a
23
- Work (the “Affirmer”), to the extent that he or she is an owner of Copyright
24
- and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and
25
- publicly distribute the Work under its terms, with knowledge of his or her
26
- Copyright and Related Rights in the Work and the meaning and intended legal
27
- effect of CC0 on those rights.
28
-
29
- 1. Copyright and Related Rights. A Work made available under CC0 may be
30
- protected by copyright and related or neighboring rights (“Copyright and
31
- Related Rights”). Copyright and Related Rights include, but are not limited
32
- to, the following:
33
- 1. the right to reproduce, adapt, distribute, perform, display, communicate,
34
- and translate a Work;
35
- 2. moral rights retained by the original author(s) and/or performer(s);
36
- 3. publicity and privacy rights pertaining to a person’s image or likeness
37
- depicted in a Work;
38
- 4. rights protecting against unfair competition in regards to a Work,
39
- subject to the limitations in paragraph 4(i), below;
40
- 5. rights protecting the extraction, dissemination, use and reuse of data in
41
- a Work;
42
- 6. database rights (such as those arising under Directive 96/9/EC of the
43
- European Parliament and of the Council of 11 March 1996 on the legal
44
- protection of databases, and under any national implementation thereof,
45
- including any amended or successor version of such directive); and
46
- 7. other similar, equivalent or corresponding rights throughout the world
47
- based on applicable law or treaty, and any national implementations
48
- thereof.
49
-
50
- 2. Waiver. To the greatest extent permitted by, but not in contravention of,
51
- applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
52
- unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright
53
- and Related Rights and associated claims and causes of action, whether now
54
- known or unknown (including existing as well as future claims and causes of
55
- action), in the Work (i) in all territories worldwide, (ii) for the maximum
56
- duration provided by applicable law or treaty (including future time
57
- extensions), (iii) in any current or future medium and for any number of
58
- copies, and (iv) for any purpose whatsoever, including without limitation
59
- commercial, advertising or promotional purposes (the “Waiver”). Affirmer
60
- makes the Waiver for the benefit of each member of the public at large and
61
- to the detriment of Affirmer’s heirs and successors, fully intending that
62
- such Waiver shall not be subject to revocation, rescission, cancellation,
63
- termination, or any other legal or equitable action to disrupt the quiet
64
- enjoyment of the Work by the public as contemplated by Affirmer’s express
65
- Statement of Purpose.
66
-
67
- 3. Public License Fallback. Should any part of the Waiver for any reason be
68
- judged legally invalid or ineffective under applicable law, then the Waiver
69
- shall be preserved to the maximum extent permitted taking into account
70
- Affirmer’s express Statement of Purpose. In addition, to the extent the
71
- Waiver is so judged Affirmer hereby grants to each affected person a
72
- royalty-free, non transferable, non sublicensable, non exclusive,
73
- irrevocable and unconditional license to exercise Affirmer’s Copyright and
74
- Related Rights in the Work (i) in all territories worldwide, (ii) for the
75
- maximum duration provided by applicable law or treaty (including future time
76
- extensions), (iii) in any current or future medium and for any number of
77
- copies, and (iv) for any purpose whatsoever, including without limitation
78
- commercial, advertising or promotional purposes (the “License”). The License
79
- shall be deemed effective as of the date CC0 was applied by Affirmer to the
80
- Work. Should any part of the License for any reason be judged legally
81
- invalid or ineffective under applicable law, such partial invalidity or
82
- ineffectiveness shall not invalidate the remainder of the License, and in
83
- such case Affirmer hereby affirms that he or she will not (i) exercise any
84
- of his or her remaining Copyright and Related Rights in the Work or (ii)
85
- assert any associated claims and causes of action with respect to the Work,
86
- in either case contrary to Affirmer’s express Statement of Purpose.
87
-
88
- 4. Limitations and Disclaimers.
89
- 1. No trademark or patent rights held by Affirmer are waived, abandoned,
90
- surrendered, licensed or otherwise affected by this document.
91
- 2. Affirmer offers the Work as-is and makes no representations or warranties
92
- of any kind concerning the Work, express, implied, statutory or
93
- otherwise, including without limitation warranties of title,
94
- merchantability, fitness for a particular purpose, non infringement, or
95
- the absence of latent or other defects, accuracy, or the present or
96
- absence of errors, whether or not discoverable, all to the greatest
97
- extent permissible under applicable law.
98
- 3. Affirmer disclaims responsibility for clearing rights of other persons
99
- that may apply to the Work or any use thereof, including without
100
- limitation any person’s Copyright and Related Rights in the Work.
101
- Further, Affirmer disclaims responsibility for obtaining any necessary
102
- consents, permissions or other rights required for any use of the Work.
103
- 4. Affirmer understands and acknowledges that Creative Commons is not a
104
- party to this document and has no duty or obligation with respect to this
105
- CC0 or use of the Work.
106
-
107
- For more information, please see
108
- http://creativecommons.org/publicdomain/zero/1.0/.
1
+ MIT No Attribution (MIT-0)
2
+
3
+ Copyright © CSSTools Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the “Software”), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so.
11
+
12
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
package/README.md CHANGED
@@ -2,8 +2,16 @@
2
2
 
3
3
  [<img alt="npm version" src="https://img.shields.io/npm/v/css-has-pseudo.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/has-pseudo-class.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
4
4
 
5
+ ```bash
6
+ npm install css-has-pseudo --save-dev
7
+ ```
8
+
5
9
  [PostCSS Has Pseudo] lets you style elements relative to other elements in CSS, following the [Selectors Level 4] specification.
6
10
 
11
+ To use this feature you need to do two things :
12
+ - add the [PostCSS plugin](#usage) that transforms the selector into a class or attribute
13
+ - add the [browser polyfill](#browser) that sets the attribute or class on elements in a browser
14
+
7
15
  ```pcss
8
16
  .title:has(+ p) {
9
17
  margin-bottom: 1.5rem;
@@ -106,6 +114,16 @@ After :
106
114
 
107
115
  ## ⚠️ Known shortcomings
108
116
 
117
+ ### Performance
118
+
119
+ Determining which elements match a `:has` selector is relatively slow through a polyfill compared to the native feature.
120
+
121
+ A very large DOM or many and complex `:has` selectors can cause performance issues.
122
+ JavaScript frameworks that rewrite the DOM will be particularly affected by this.
123
+
124
+ _Any contributions to speedup matching are welcome.
125
+ Please open an issue to discuss proposed changes if you are interested in contributing._
126
+
109
127
  ### Specificity
110
128
 
111
129
  `:has` transforms will result in at least one attribute selector with specificity `0, 1, 0`.<br>
@@ -139,7 +157,7 @@ Then we can investigate and maybe fix these.
139
157
  ## Browser
140
158
 
141
159
  ```js
142
- // initialize prefersColorScheme (applies the current OS color scheme, if available)
160
+ // initialize cssHasPseudo
143
161
  import cssHasPseudo from 'css-has-pseudo/browser';
144
162
  cssHasPseudo(document);
145
163
  ```
@@ -148,12 +166,13 @@ or
148
166
 
149
167
  ```html
150
168
  <!-- When using a CDN url you will have to manually update the version number -->
151
- <script src="https://unpkg.com/css-has-pseudo@5.0.2/dist/browser-global.js"></script>
169
+ <script src="https://unpkg.com/css-has-pseudo@6.0.1/dist/browser-global.js"></script>
152
170
  <script>cssHasPseudo(document)</script>
153
171
  ```
154
172
 
155
- ⚠️ Please use a versioned url, like this : `https://unpkg.com/css-has-pseudo@5.0.2/dist/browser-global.js`
156
- Without the version, you might unexpectedly get a new major version of the library with breaking changes.
173
+ > [!TIP]
174
+ > Please use a versioned url, like this : `https://unpkg.com/css-has-pseudo@6.0.1/dist/browser-global.js`
175
+ > Without the version, you might unexpectedly get a new major version of the library with breaking changes.
157
176
 
158
177
  [PostCSS Has Pseudo] works in all major browsers, including
159
178
  Internet Explorer 11. With a [Mutation Observer polyfill](https://github.com/webmodules/mutation-observer), the script will work
@@ -220,10 +239,11 @@ ECMA Script:
220
239
 
221
240
  ## CORS
222
241
 
223
- ⚠️ Applies to you if you load CSS from a different domain than the page.
224
-
225
- In this case the CSS is treated as untrusted and will not be made available to the JavaScript polyfill.
226
- The polyfill will not work without applying the correct configuration for CORS.
242
+ > [!IMPORTANT]
243
+ > Applies to you if you load CSS from a different domain than the page.
244
+ >
245
+ > In this case the CSS is treated as untrusted and will not be made available to the JavaScript polyfill.
246
+ > The polyfill will not work without applying the correct configuration for CORS.
227
247
 
228
248
  Example :
229
249
 
@@ -1,2 +1,2 @@
1
- !function(){function decodeCSS(e){if("csstools-has-"!==e.slice(0,13))return"";for(var t=(e=e.slice(13)).split("-"),r="",o=0;o<t.length;o++)r+=String.fromCharCode(parseInt(t[o],36));return r}function extractEncodedSelectors(e){for(var t,r,o=[],n=0,s=!1,l=!1,i=0;i<e.length;i++){var c=e[i];switch(c){case"[":if(s){t+=c;continue}0===n?t="":t+=c,n++;continue;case"]":if(s){t+=c;continue}if(0===--n){var a=decodeCSS(t);l&&o.push(a)}else t+=c;continue;case"\\":t+=e[i],t+=e[i+1],i++;continue;case'"':case"'":if(s&&c===r){s=!1;continue}if(s){t+=c;continue}s=!0,r=c;continue;default:""===t&&1===n&&"csstools-has-"===e.slice(i,i+13)&&(l=!0),t+=c;continue}}for(var u=[],p=0;p<o.length;p++)-1===u.indexOf(o[p])&&u.push(o[p]);return u}function encodeCSS(e){if(""===e)return"";for(var t,r="",o=0;o<e.length;o++)t=e.charCodeAt(o).toString(36),r+=0===o?t:"-"+t;return"csstools-has-"+r}function hasNativeSupport(){try{if(!("CSS"in self)||!("supports"in self.CSS)||!self.CSS.supports("selector(:has(div))"))return!1}catch(e){return!1}return!0}function cssHasPseudo(e,t){t||(t={}),(t={hover:!!t.hover||!1,debug:!!t.debug||!1,observedAttributes:t.observedAttributes||[],forcePolyfill:!!t.forcePolyfill||!1}).mustPolyfill=t.forcePolyfill||!hasNativeSupport(),Array.isArray(t.observedAttributes)||(t.observedAttributes=[]),t.observedAttributes=t.observedAttributes.filter((function(e){return"string"==typeof e})),t.observedAttributes=t.observedAttributes.concat(["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","buffered","capture","challenge","charset","checked","cite","class","code","codebase","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","data","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","enctype","enterkeyhint","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","headers","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","intrinsicsize","inputmode","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]);var r=[],o=e.createElement("x");if([].forEach.call(e.styleSheets,walkStyleSheet),t.mustPolyfill){if(transformObservedItemsThrottled(),"MutationObserver"in self)new MutationObserver((function(t){t.forEach((function(t){[].forEach.call(t.addedNodes||[],(function(e){1===e.nodeType&&e.sheet&&walkStyleSheet(e.sheet)})),[].push.apply(r,r.splice(0).filter((function(t){return t.rule.parentStyleSheet&&t.rule.parentStyleSheet.ownerNode&&e.documentElement.contains(t.rule.parentStyleSheet.ownerNode)}))),transformObservedItemsThrottled()}))})).observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:t.observedAttributes});if(e.addEventListener("focus",transformObservedItemsThrottled,!0),e.addEventListener("blur",transformObservedItemsThrottled,!0),e.addEventListener("input",transformObservedItemsThrottled),e.addEventListener("change",transformObservedItemsThrottled,!0),t.hover&&("onpointerenter"in e?(e.addEventListener("pointerenter",transformObservedItemsThrottled,!0),e.addEventListener("pointerleave",transformObservedItemsThrottled,!0)):(e.addEventListener("mouseover",transformObservedItemsThrottled,!0),e.addEventListener("mouseout",transformObservedItemsThrottled,!0))),"defineProperty"in Object&&"getOwnPropertyDescriptor"in Object&&"hasOwnProperty"in Object)try{var n=function observeProperty(e,t){if(e.hasOwnProperty(t)){var r=Object.getOwnPropertyDescriptor(e,t);r&&r.configurable&&"set"in r&&Object.defineProperty(e,t,{configurable:r.configurable,enumerable:r.enumerable,get:function get(){return r.get.apply(this,arguments)},set:function set(){r.set.apply(this,arguments);try{transformObservedItemsThrottled()}catch(e){}}})}};"HTMLElement"in self&&HTMLElement.prototype&&n(HTMLElement.prototype,"disabled"),["checked","selected","readOnly","required"].forEach((function(e){["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLMeterElement","HTMLOptGroupElement","HTMLOptionElement","HTMLOutputElement","HTMLProgressElement","HTMLSelectElement","HTMLTextAreaElement"].forEach((function(t){t in self&&self[t].prototype&&n(self[t].prototype,e)}))}))}catch(l){t.debug&&console.error(l)}var s=!1}function transformObservedItemsThrottled(){s&&cancelAnimationFrame(s),s=requestAnimationFrame((function(){r.forEach((function(r){var n=[],s=[];try{s=e.querySelectorAll(r.selector)}catch(l){return void(t.debug&&console.error(l))}[].forEach.call(s,(function(t){n.push(t),o.innerHTML="<x "+r.attributeName+">",t.setAttributeNode(o.children[0].attributes[0].cloneNode()),e.documentElement.style.zoom=1,e.documentElement.style.zoom=null})),r.nodes.forEach((function(t){-1===n.indexOf(t)&&(t.removeAttribute(r.attributeName),e.documentElement.style.zoom=1,e.documentElement.style.zoom=null)})),r.nodes=n}))}))}function walkStyleSheet(e){try{[].forEach.call(e.cssRules||[],(function(o,n){if(o.selectorText){o.selectorText=o.selectorText.replace(/\.js-has-pseudo\s/g,"");try{var s=extractEncodedSelectors(o.selectorText.toString());if(0===s.length)return;if(!t.mustPolyfill)return void e.deleteRule(n);for(var i=0;i<s.length;i++){var c=s[i];r.push({rule:o,selector:c,attributeName:encodeCSS(c),nodes:[]})}}catch(l){t.debug&&console.error(l)}}else walkStyleSheet(o)}))}catch(l){t.debug&&console.error(l)}}}!function(e){try{if(e.document.querySelector(":has(*, :does-not-exist, > *)"),!e.document.querySelector(":has(:scope *)")&&CSS.supports("selector(:has(div))"))return}catch(a){}var t=polyfill(e.Element.prototype.querySelector);e.Element.prototype.querySelector=function querySelector(e){return t.apply(this,arguments)};var r=polyfill(e.Element.prototype.querySelectorAll);if(e.Element.prototype.querySelectorAll=function querySelectorAll(e){return r.apply(this,arguments)},e.Element.prototype.matches){var o=polyfill(e.Element.prototype.matches);e.Element.prototype.matches=function matches(e){return o.apply(this,arguments)}}if(e.Element.prototype.closest){var n=polyfill(e.Element.prototype.closest);e.Element.prototype.closest=function closest(e){return n.apply(this,arguments)}}if("Document"in e&&"prototype"in e.Document){var s=polyfill(e.Document.prototype.querySelector);e.Document.prototype.querySelector=function querySelector(e){return s.apply(this,arguments)};var l=polyfill(e.Document.prototype.querySelectorAll);if(e.Document.prototype.querySelectorAll=function querySelectorAll(e){return l.apply(this,arguments)},e.Document.prototype.matches){var i=polyfill(e.Document.prototype.matches);e.Document.prototype.matches=function matches(e){return i.apply(this,arguments)}}if(e.Document.prototype.closest){var c=polyfill(e.Document.prototype.closest);e.Document.prototype.closest=function closest(e){return c.apply(this,arguments)}}}function pseudoClassHasInnerQuery(e){for(var t="",r=0,o=0,n=!1,s=!1,l=!1,i=!1,c=0;c<e.length;c++){var a=e[c];if(n)t+=a,n=!1;else if(s)a===l&&(s=!1),t+=a;else switch(":has("!==t.toLowerCase()||i||(i=!0,r=c,t=""),a){case":":i||(t=""),t+=a;continue;case"(":i&&o++,t+=a;continue;case")":if(i){if(0===o)return{innerQuery:t,start:r,end:c-1};o--}t+=a;continue;case"\\":t+=a,n=!0;continue;case'"':case"'":t+=a,s=!0,l=a;continue;default:t+=a;continue}}return!1}function replaceScopeWithAttr(e,t){for(var r=[],o="",n=!1,s=!1,l=!1,i=0,c=0;c<e.length;c++){var a=e[c];if(n)o+=a,n=!1;else if(s)a===l&&(s=!1),o+=a;else switch(":scope"===o.toLowerCase()&&!i&&/^[\[\.\:\\"\s|+>~#&,)]/.test(a||"")&&(r.push(o.slice(0,o.length-6)),r.push("["+t+"]"),o=""),a){case":":r.push(o),o="",o+=a;continue;case"\\":o+=a,n=!0;continue;case'"':case"'":o+=a,s=!0,l=a;continue;case"[":o+=a,i++;continue;case"]":o+=a,i>0&&i--;continue;default:o+=a;continue}}return":scope"===o.toLowerCase()&&(r.push(o.slice(0,o.length-6)),r.push("["+t+"]"),o=""),0===r.length?e:r.join("")+o}function splitSelector(e){for(var t,r,o=[],n="",s=!1,l=!1,i=!1,c=!1,a=0,u=0;u<e.length;u++){var p=e[u];if(s)n+=p,s=!1;else switch(p){case",":if(l){n+=p;continue}if(a>0){n+=p;continue}o.push(n),n="";continue;case"\\":n+=p,s=!0;continue;case'"':case"'":if(l&&p===i){n+=p,l=!1;continue}n+=p,l=!0,i=p;continue;case"(":case")":case"[":case"]":if(l){n+=p;continue}if(t=p,"("===(r=c)&&")"===t||"["===r&&"]"===t){n+=p,0===--a&&(c=!1);continue}if(p===c){n+=p,a++;continue}n+=p,a++,c=p;continue;default:n+=p;continue}}return o.push(n),o}function replaceAllWithTempAttr(e,t,r){var o=pseudoClassHasInnerQuery(e);if(!o)return e;if(t)return!1;var n=o.innerQuery,s="q-has"+(Math.floor(9e6*Math.random())+1e6),l="["+s+"]",i=e;if(o.innerQuery.toLowerCase().indexOf(":has(")>-1){for(var c=splitSelector(o.innerQuery),a=[],u=0;u<c.length;u++){var p=c[u];if(!replaceAllWithTempAttr(p,!0,(function(){})))throw new Error("Nested :has() is not supported");a.push(p)}var f=i.substring(0,o.start-5),d=i.substring(o.end+2);return f+a.join(", ")+d}f=i.substring(0,o.start-5),d=i.substring(o.end+2);if(i=f+l+d,r(n,s),i.toLowerCase().indexOf(":has(")>-1){var h=replaceAllWithTempAttr(i,!1,r);if(h)return h}return i}function walkNode(e,t){if("setAttribute"in e&&"querySelector"in e&&t(e),e.hasChildNodes())for(var r=e.childNodes,o=0;o<r.length;++o)walkNode(r[o],t)}function polyfill(t){return function(r){if(-1===r.toLowerCase().indexOf(":has(")||!pseudoClassHasInnerQuery(r))return t.apply(this,arguments);var o;if("getRootNode"in this)o=this.getRootNode();else for(var n=this;n;)o=n,n=n.parentNode;var s=this;s===e.document&&(s=e.document.documentElement);var l="q-has-scope"+(Math.floor(9e6*Math.random())+1e6);s.setAttribute(l,"");try{r=replaceScopeWithAttr(r,l);var i=[l],c=replaceAllWithTempAttr(r,!1,(function(e,t){i.push(t);for(var r=splitSelector(e),n=0;n<r.length;n++){var s=r[n].trim(),l=s;l=">"===s[0]||"+"===s[0]||"~"===s[0]?s.slice(1).trim():":scope "+s,walkNode(o,(function(e){if(e.querySelector(l))switch(s[0]){case"~":case"+":for(var r=e.childNodes,o=0;o<r.length;o++){var n=r[o];if("setAttribute"in n){var i="q-has-id"+(Math.floor(9e6*Math.random())+1e6);n.setAttribute(i,""),e.querySelector(":scope ["+i+"] "+s)&&n.setAttribute(t,""),n.removeAttribute(i)}}break;case">":i="q-has-id"+(Math.floor(9e6*Math.random())+1e6);e.setAttribute(i,""),e.querySelector(":scope["+i+"] "+s)&&e.setAttribute(t,""),e.removeAttribute(i);break;default:e.setAttribute(t,"")}}))}}));arguments[0]=c;var u=t.apply(this,arguments);if(s.removeAttribute(l),i.length>0){for(var p=[],f=0;f<i.length;f++)p.push("["+i[f]+"]");for(var d=e.document.querySelectorAll(p.join(",")),h=0;h<d.length;h++)for(var m=d[h],y=0;y<i.length;y++)m.removeAttribute(i[y])}return u}catch(b){if(s.removeAttribute(l),i.length>0){for(p=[],f=0;f<i.length;f++)p.push("["+i[f]+"]");for(d=e.document.querySelectorAll(p.join(",")),h=0;h<d.length;h++)for(m=d[h],y=0;y<i.length;y++)m.removeAttribute(i[y])}var v="";try{t.apply(this,[":core-web-does-not-exist"])}catch(g){v=g.message,v&&(v=v.replace(":core-web-does-not-exist",r))}v||(v="Failed to execute 'querySelector' on 'Document': '"+r+"' is not a valid selector.");try{throw new DOMException(v)}catch(a){throw new Error(v)}}}}}(self),("object"==typeof window&&window||"object"==typeof self&&self||{}).cssHasPseudo=cssHasPseudo}();
1
+ !function(){function decodeCSS(e){if("csstools-has-"!==e.slice(0,13))return"";for(var t=(e=e.slice(13)).split("-"),r="",o=0;o<t.length;o++)r+=String.fromCharCode(parseInt(t[o],36));return r}function extractEncodedSelectors(e){for(var t,r,o=[],n=0,s=!1,l=!1,i=0;i<e.length;i++){var c=e[i];switch(c){case"[":if(s){t+=c;continue}0===n?t="":t+=c,n++;continue;case"]":if(s){t+=c;continue}if(0===--n){var a=decodeCSS(t);l&&o.push(a)}else t+=c;continue;case"\\":t+=e[i],t+=e[i+1],i++;continue;case'"':case"'":if(s&&c===r){s=!1;continue}if(s){t+=c;continue}s=!0,r=c;continue;default:""===t&&1===n&&"csstools-has-"===e.slice(i,i+13)&&(l=!0),t+=c;continue}}for(var u=[],p=0;p<o.length;p++)-1===u.indexOf(o[p])&&u.push(o[p]);return u}function encodeCSS(e){if(""===e)return"";for(var t,r="",o=0;o<e.length;o++)t=e.charCodeAt(o).toString(36),r+=0===o?t:"-"+t;return"csstools-has-"+r}function hasNativeSupport(){try{if(!("CSS"in self)||!("supports"in self.CSS)||!self.CSS.supports("selector(:has(div))"))return!1}catch(e){return!1}return!0}function cssHasPseudo(e,t){t||(t={}),(t={hover:!!t.hover||!1,debug:!!t.debug||!1,observedAttributes:t.observedAttributes||[],forcePolyfill:!!t.forcePolyfill||!1}).mustPolyfill=t.forcePolyfill||!hasNativeSupport(),Array.isArray(t.observedAttributes)||(t.observedAttributes=[]),t.observedAttributes=t.observedAttributes.filter((function(e){return"string"==typeof e})),t.observedAttributes=t.observedAttributes.concat(["accept","accept-charset","accesskey","action","align","allow","alt","async","autocapitalize","autocomplete","autofocus","autoplay","buffered","capture","challenge","charset","checked","cite","class","code","codebase","cols","colspan","content","contenteditable","contextmenu","controls","coords","crossorigin","csp","data","datetime","decoding","default","defer","dir","dirname","disabled","download","draggable","enctype","enterkeyhint","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","headers","hidden","high","href","hreflang","http-equiv","icon","id","importance","integrity","intrinsicsize","inputmode","ismap","itemprop","keytype","kind","label","lang","language","list","loop","low","manifest","max","maxlength","minlength","media","method","min","multiple","muted","name","novalidate","open","optimum","pattern","ping","placeholder","poster","preload","radiogroup","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","sandbox","scope","scoped","selected","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","summary","tabindex","target","title","translate","type","usemap","value","width","wrap"]);var r=[],o=e.createElement("x");if([].forEach.call(e.styleSheets,walkStyleSheet),t.mustPolyfill){if(transformObservedItemsThrottled(),"MutationObserver"in self)new MutationObserver((function(t){t.forEach((function(t){[].forEach.call(t.addedNodes||[],(function(e){1===e.nodeType&&e.sheet&&walkStyleSheet(e.sheet)})),[].push.apply(r,r.splice(0).filter((function(t){return t.rule.parentStyleSheet&&t.rule.parentStyleSheet.ownerNode&&e.documentElement.contains(t.rule.parentStyleSheet.ownerNode)}))),transformObservedItemsThrottled()}))})).observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:t.observedAttributes});if(e.addEventListener("focus",transformObservedItemsThrottled,!0),e.addEventListener("blur",transformObservedItemsThrottled,!0),e.addEventListener("input",transformObservedItemsThrottled),e.addEventListener("change",transformObservedItemsThrottled,!0),t.hover&&("onpointerenter"in e?(e.addEventListener("pointerenter",transformObservedItemsThrottled,!0),e.addEventListener("pointerleave",transformObservedItemsThrottled,!0)):(e.addEventListener("mouseover",transformObservedItemsThrottled,!0),e.addEventListener("mouseout",transformObservedItemsThrottled,!0))),"defineProperty"in Object&&"getOwnPropertyDescriptor"in Object&&"hasOwnProperty"in Object)try{var n=function observeProperty(e,t){if(e.hasOwnProperty(t)){var r=Object.getOwnPropertyDescriptor(e,t);r&&r.configurable&&"set"in r&&Object.defineProperty(e,t,{configurable:r.configurable,enumerable:r.enumerable,get:function get(){return r.get.apply(this,arguments)},set:function set(){r.set.apply(this,arguments);try{transformObservedItemsThrottled()}catch(e){}}})}};"HTMLElement"in self&&HTMLElement.prototype&&n(HTMLElement.prototype,"disabled"),["checked","selected","readOnly","required"].forEach((function(e){["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLMeterElement","HTMLOptGroupElement","HTMLOptionElement","HTMLOutputElement","HTMLProgressElement","HTMLSelectElement","HTMLTextAreaElement"].forEach((function(t){t in self&&self[t].prototype&&n(self[t].prototype,e)}))}))}catch(l){t.debug&&console.error(l)}var s=!1}function transformObservedItemsThrottled(){s&&cancelAnimationFrame(s),s=requestAnimationFrame((function(){r.forEach((function(r){var n=[],s=[];try{s=e.querySelectorAll(r.selector)}catch(l){return void(t.debug&&console.error(l))}[].forEach.call(s,(function(t){n.push(t),o.innerHTML="<x "+r.attributeName+">",t.setAttributeNode(o.children[0].attributes[0].cloneNode()),e.documentElement.style.zoom=1,e.documentElement.style.zoom=null})),r.nodes.forEach((function(t){-1===n.indexOf(t)&&(t.removeAttribute(r.attributeName),e.documentElement.style.zoom=1,e.documentElement.style.zoom=null)})),r.nodes=n}))}))}function walkStyleSheet(e){try{[].forEach.call(e.cssRules||[],(function(o,n){if(o.selectorText){o.selectorText=o.selectorText.replace(/\.js-has-pseudo\s/g,"");try{var s=extractEncodedSelectors(o.selectorText.toString());if(0===s.length)return;if(!t.mustPolyfill)return void e.deleteRule(n);for(var i=0;i<s.length;i++){var c=s[i];r.push({rule:o,selector:c,attributeName:encodeCSS(c),nodes:[]})}}catch(l){t.debug&&console.error(l)}}else walkStyleSheet(o)}))}catch(l){t.debug&&console.error(l)}}}!function(e){try{if(e.document.querySelector(":has(*, :does-not-exist, > *)"),!e.document.querySelector(":has(:scope *)")&&CSS.supports("selector(:has(div))"))return}catch(a){}var t=polyfill(e.Element.prototype.querySelector);e.Element.prototype.querySelector=function querySelector(e){return t.apply(this,arguments)};var r=polyfill(e.Element.prototype.querySelectorAll);if(e.Element.prototype.querySelectorAll=function querySelectorAll(e){return r.apply(this,arguments)},e.Element.prototype.matches){var o=polyfill(e.Element.prototype.matches);e.Element.prototype.matches=function matches(e){return o.apply(this,arguments)}}if(e.Element.prototype.closest){var n=polyfill(e.Element.prototype.closest);e.Element.prototype.closest=function closest(e){return n.apply(this,arguments)}}if("Document"in e&&"prototype"in e.Document){var s=polyfill(e.Document.prototype.querySelector);e.Document.prototype.querySelector=function querySelector(e){return s.apply(this,arguments)};var l=polyfill(e.Document.prototype.querySelectorAll);if(e.Document.prototype.querySelectorAll=function querySelectorAll(e){return l.apply(this,arguments)},e.Document.prototype.matches){var i=polyfill(e.Document.prototype.matches);e.Document.prototype.matches=function matches(e){return i.apply(this,arguments)}}if(e.Document.prototype.closest){var c=polyfill(e.Document.prototype.closest);e.Document.prototype.closest=function closest(e){return c.apply(this,arguments)}}}function pseudoClassHasInnerQuery(e){for(var t="",r=0,o=0,n=!1,s=!1,l=!1,i=!1,c=0;c<e.length;c++){var a=e[c];if(n)t+=a,n=!1;else if(s)a===l&&(s=!1),t+=a;else switch(":has("!==t.toLowerCase()||i||(i=!0,r=c,t=""),a){case":":i||(t=""),t+=a;continue;case"(":i&&o++,t+=a;continue;case")":if(i){if(0===o)return{innerQuery:t,start:r,end:c-1};o--}t+=a;continue;case"\\":t+=a,n=!0;continue;case'"':case"'":t+=a,s=!0,l=a;continue;default:t+=a;continue}}return!1}function replaceScopeWithAttr(e,t){for(var r=[],o="",n=!1,s=!1,l=!1,i=0,c=0;c<e.length;c++){var a=e[c];if(n)o+=a,n=!1;else if(s)a===l&&(s=!1),o+=a;else switch(":scope"===o.toLowerCase()&&!i&&/^[\[\.\:\\"\s|+>~#&,)]/.test(a||"")&&(r.push(o.slice(0,o.length-6)),r.push("["+t+"]"),o=""),a){case":":r.push(o),o="",o+=a;continue;case"\\":o+=a,n=!0;continue;case'"':case"'":o+=a,s=!0,l=a;continue;case"[":o+=a,i++;continue;case"]":o+=a,i>0&&i--;continue;default:o+=a;continue}}return":scope"===o.toLowerCase()&&(r.push(o.slice(0,o.length-6)),r.push("["+t+"]"),o=""),0===r.length?e:r.join("")+o}function splitSelector(e){for(var t,r,o=[],n="",s=!1,l=!1,i=!1,c=!1,a=0,u=0;u<e.length;u++){var p=e[u];if(s)n+=p,s=!1;else switch(p){case",":if(l){n+=p;continue}if(a>0){n+=p;continue}o.push(n),n="";continue;case"\\":n+=p,s=!0;continue;case'"':case"'":if(l&&p===i){n+=p,l=!1;continue}n+=p,l=!0,i=p;continue;case"(":case")":case"[":case"]":if(l){n+=p;continue}if(t=p,"("===(r=c)&&")"===t||"["===r&&"]"===t){n+=p,0===--a&&(c=!1);continue}if(p===c){n+=p,a++;continue}n+=p,a++,c=p;continue;default:n+=p;continue}}return o.push(n),o}function replaceAllWithTempAttr(e,t,r){var o=pseudoClassHasInnerQuery(e);if(!o)return e;if(t)return!1;var n=o.innerQuery,s="q-has"+(Math.floor(9e6*Math.random())+1e6),l="["+s+"]",i=e;if(o.innerQuery.toLowerCase().indexOf(":has(")>-1){for(var c=splitSelector(o.innerQuery),a=[],u=0;u<c.length;u++){var p=c[u];if(!replaceAllWithTempAttr(p,!0,(function(){})))throw new Error("Nested :has() is not supported");a.push(p)}var f=i.substring(0,o.start-5),d=i.substring(o.end+2);return f+a.join(", ")+d}f=i.substring(0,o.start-5),d=i.substring(o.end+2);if(i=f+l+d,r(n,s),i.toLowerCase().indexOf(":has(")>-1){var h=replaceAllWithTempAttr(i,!1,r);if(h)return h}return i}function walkNode(e,t){if("setAttribute"in e&&"querySelector"in e&&t(e),e.hasChildNodes())for(var r=e.childNodes,o=0;o<r.length;++o)walkNode(r[o],t)}function polyfill(t){return function(r){if(!r)return t.apply(this,arguments);var o,n=String(r);if(!n||-1===n.toLowerCase().indexOf(":has(")||!pseudoClassHasInnerQuery(n))return t.apply(this,arguments);if("getRootNode"in this)o=this.getRootNode();else for(var s=this;s;)o=s,s=s.parentNode;var l=this;l===e.document&&(l=e.document.documentElement);var i="q-has-scope"+(Math.floor(9e6*Math.random())+1e6);l.setAttribute(i,"");try{n=replaceScopeWithAttr(n,i);var c=[i],u=replaceAllWithTempAttr(n,!1,(function(e,t){c.push(t);for(var r=splitSelector(e),n=0;n<r.length;n++){var s=r[n].trim(),l=s;l=">"===s[0]||"+"===s[0]||"~"===s[0]?s.slice(1).trim():":scope "+s,walkNode(o,(function(e){if(e.querySelector(l))switch(s[0]){case"~":case"+":for(var r=e.childNodes,o=0;o<r.length;o++){var n=r[o];if("setAttribute"in n){var i="q-has-id"+(Math.floor(9e6*Math.random())+1e6);n.setAttribute(i,""),e.querySelector(":scope ["+i+"] "+s)&&n.setAttribute(t,""),n.removeAttribute(i)}}break;case">":i="q-has-id"+(Math.floor(9e6*Math.random())+1e6);e.setAttribute(i,""),e.querySelector(":scope["+i+"] "+s)&&e.setAttribute(t,""),e.removeAttribute(i);break;default:e.setAttribute(t,"")}}))}}));arguments[0]=u;var p=t.apply(this,arguments);if(l.removeAttribute(i),c.length>0){for(var f=[],d=0;d<c.length;d++)f.push("["+c[d]+"]");for(var h=e.document.querySelectorAll(f.join(",")),m=0;m<h.length;m++)for(var y=h[m],v=0;v<c.length;v++)y.removeAttribute(c[v])}return p}catch(g){if(l.removeAttribute(i),c.length>0){for(f=[],d=0;d<c.length;d++)f.push("["+c[d]+"]");for(h=e.document.querySelectorAll(f.join(",")),m=0;m<h.length;m++)for(y=h[m],v=0;v<c.length;v++)y.removeAttribute(c[v])}var b="";try{t.apply(this,[":core-web-does-not-exist"])}catch(S){b=S.message,b&&(b=b.replace(":core-web-does-not-exist",n))}b||(b="Failed to execute 'querySelector' on 'Document': '"+n+"' is not a valid selector.");try{throw new DOMException(b)}catch(a){throw new Error(b)}}}}}(self),("object"==typeof window&&window||"object"==typeof self&&self||{}).cssHasPseudo=cssHasPseudo}();
2
2
  //# sourceMappingURL=browser-global.js.map