css-blank-pseudo 5.0.2 → 6.0.0
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 +57 -17
- package/LICENSE.md +18 -108
- package/README.md +5 -1
- package/dist/browser-global.js.map +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.mjs.map +1 -1
- package/package.json +18 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
# Changes to CSS Blank Pseudo
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### 6.0.0
|
|
4
|
+
|
|
5
|
+
_July 3, 2023_
|
|
6
|
+
|
|
7
|
+
- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/))
|
|
8
|
+
|
|
9
|
+
### 5.0.2
|
|
10
|
+
|
|
11
|
+
_February 6, 2023_
|
|
4
12
|
|
|
5
13
|
- Reduce the amount of duplicate fallback CSS.
|
|
6
14
|
|
|
7
|
-
### 5.0.1
|
|
15
|
+
### 5.0.1
|
|
16
|
+
|
|
17
|
+
_January 28, 2023_
|
|
8
18
|
|
|
9
19
|
- Improve `types` declaration in `package.json`
|
|
10
20
|
|
|
11
|
-
### 5.0.0
|
|
21
|
+
### 5.0.0
|
|
22
|
+
|
|
23
|
+
_January 24, 2023_
|
|
12
24
|
|
|
13
25
|
- Updated: Support for Node v14+ (major).
|
|
14
26
|
- Fix: Do not throw when a selector is invalid, show a warning instead.
|
|
15
27
|
- Updated: Export and document the plugin options types.
|
|
16
28
|
|
|
17
|
-
### 4.1.1
|
|
29
|
+
### 4.1.1
|
|
30
|
+
|
|
31
|
+
_August 23, 2022_
|
|
18
32
|
|
|
19
33
|
- Fix: assign global browser polyfill to `window`, `self` or a blank object.
|
|
20
34
|
|
|
21
|
-
### 4.1.0
|
|
35
|
+
### 4.1.0
|
|
36
|
+
|
|
37
|
+
_July 30, 2022_
|
|
22
38
|
|
|
23
39
|
- Added: `disablePolyfillReadyClass` plugin option to prevent `.js-blank-pseudo` from being added.
|
|
24
40
|
|
|
25
|
-
### 4.0.0
|
|
41
|
+
### 4.0.0
|
|
42
|
+
|
|
43
|
+
_July 8, 2022_
|
|
26
44
|
|
|
27
45
|
- Updated: The polyfill now only attaches a single listener to the body so it's
|
|
28
46
|
more efficient and also does less work at the MutationObserver handler.
|
|
@@ -56,20 +74,28 @@ more efficient and also does less work at the MutationObserver handler.
|
|
|
56
74
|
+ })
|
|
57
75
|
```
|
|
58
76
|
|
|
59
|
-
### 3.0.3
|
|
77
|
+
### 3.0.3
|
|
78
|
+
|
|
79
|
+
_February 5, 2022_
|
|
60
80
|
|
|
61
81
|
- Rebuild of browser polyfills
|
|
62
82
|
|
|
63
|
-
### 3.0.2
|
|
83
|
+
### 3.0.2
|
|
84
|
+
|
|
85
|
+
_January 2, 2022_
|
|
64
86
|
|
|
65
87
|
- Removed Sourcemaps from package tarball.
|
|
66
88
|
- Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121).
|
|
67
89
|
|
|
68
|
-
### 3.0.1
|
|
90
|
+
### 3.0.1
|
|
91
|
+
|
|
92
|
+
_December 27, 2021_
|
|
69
93
|
|
|
70
94
|
- Fixed: require/import paths for browser script
|
|
71
95
|
|
|
72
|
-
### 3.0.0
|
|
96
|
+
### 3.0.0
|
|
97
|
+
|
|
98
|
+
_December 13, 2021_
|
|
73
99
|
|
|
74
100
|
- Breaking: require/import paths have changed
|
|
75
101
|
- Changed: new polyfill CDN urls.
|
|
@@ -117,32 +143,46 @@ _It will continue to work for now._
|
|
|
117
143
|
+ <script src="https://unpkg.com/css-blank-pseudo/dist/browser-global.js"></script>
|
|
118
144
|
```
|
|
119
145
|
|
|
120
|
-
### 2.0.0
|
|
146
|
+
### 2.0.0
|
|
147
|
+
|
|
148
|
+
_September 16, 2021_
|
|
121
149
|
|
|
122
150
|
- Changed: Supports PostCSS 8.3+ (major).
|
|
123
151
|
- Changed: Supports Node 10+ (major).
|
|
124
152
|
|
|
125
|
-
### 1.0.0
|
|
153
|
+
### 1.0.0
|
|
154
|
+
|
|
155
|
+
_June 10, 2019_
|
|
126
156
|
|
|
127
157
|
- Updated: `postcss` to 7.0.16 (patch)
|
|
128
158
|
- Updated: Node 8+ compatibility (major)
|
|
129
159
|
|
|
130
|
-
### 0.1.4
|
|
160
|
+
### 0.1.4
|
|
161
|
+
|
|
162
|
+
_November 17, 2018_
|
|
131
163
|
|
|
132
164
|
- Update documentation
|
|
133
165
|
|
|
134
|
-
### 0.1.3
|
|
166
|
+
### 0.1.3
|
|
167
|
+
|
|
168
|
+
_November 17, 2018_
|
|
135
169
|
|
|
136
170
|
- Improve CLI usage
|
|
137
171
|
|
|
138
|
-
### 0.1.2
|
|
172
|
+
### 0.1.2
|
|
173
|
+
|
|
174
|
+
_November 17, 2018_
|
|
139
175
|
|
|
140
176
|
- Provide a version specifically for Internet Explorer 11
|
|
141
177
|
|
|
142
|
-
### 0.1.1
|
|
178
|
+
### 0.1.1
|
|
179
|
+
|
|
180
|
+
_November 17, 2018_
|
|
143
181
|
|
|
144
182
|
- Update documentation
|
|
145
183
|
|
|
146
|
-
### 0.1.0
|
|
184
|
+
### 0.1.0
|
|
185
|
+
|
|
186
|
+
_November 17, 2018_
|
|
147
187
|
|
|
148
188
|
- Initial version
|
package/LICENSE.md
CHANGED
|
@@ -1,108 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
[PostCSS Blank Pseudo] lets you style form elements when they are empty, following
|
|
6
6
|
the [Selectors Level 4] specification.
|
|
7
7
|
|
|
8
|
+
To use this feature you need to do two things :
|
|
9
|
+
- add the [PostCSS plugin](#usage) that transforms the selector into a class or attribute
|
|
10
|
+
- add the [browser polyfill](#browser) that sets the attribute or class on elements in a browser
|
|
11
|
+
|
|
8
12
|
```pcss
|
|
9
13
|
input:blank {
|
|
10
14
|
background-color: yellow;
|
|
@@ -141,7 +145,7 @@ or
|
|
|
141
145
|
|
|
142
146
|
```html
|
|
143
147
|
<!-- When using a CDN url you will have to manually update the version number -->
|
|
144
|
-
<script src="https://unpkg.com/css-blank-pseudo@
|
|
148
|
+
<script src="https://unpkg.com/css-blank-pseudo@6.0.0/dist/browser-global.js"></script>
|
|
145
149
|
<script>cssBlankPseudoInit()</script>
|
|
146
150
|
```
|
|
147
151
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-global.js","sources":["../src/is-valid-replacement.mjs","../src/browser.js","../src/browser-global.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement
|
|
1
|
+
{"version":3,"file":"browser-global.js","sources":["../src/is-valid-replacement.mjs","../src/browser.js","../src/browser-global.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement);\n\n\t// conditionally update all form control elements\n\tupdateAllCandidates();\n\n\tif (typeof self.MutationObserver !== 'undefined') {\n\t\t// conditionally observe added or unobserve removed form control elements\n\t\tnew MutationObserver(mutationsList => {\n\t\t\tmutationsList.forEach(mutation => {\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tmutation.addedNodes || [],\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && isFormControlElement(node)) {\n\t\t\t\t\t\t\thandler({ target: node });\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t}).observe(document, { childList: true, subtree: true });\n\t} else {\n\t\tconst handleOnLoad = () => updateAllCandidates();\n\n\t\twindow.addEventListener('load', handleOnLoad);\n\t\twindow.addEventListener('DOMContentLoaded', handleOnLoad);\n\t}\n}\n","/* global self,window */\nimport { default as cssBlankPseudoInit } from './browser';\n\n(function (global) {\n\tglobal.cssBlankPseudoInit = cssBlankPseudoInit;\n}('object' === typeof window && window || 'object' === typeof self && self || {}));\n"],"names":["INVALID_SELECTOR_CHAR","isValidReplacement","selector","isValid","i","length","indexOf","CSS_CLASS_LOADED","isFormControlElement","element","nodeName","createNewEvent","eventName","event","Event","bubbles","document","createEvent","initEvent","observeValueOfHTMLElement","HTMLElement","handler","descriptor","Object","getOwnPropertyDescriptor","prototype","nativeSet","set","apply","this","arguments","target","defineProperty","cssBlankPseudoInit","opts","options","force","replaceWith","Error","querySelector","ignoredError","remove","add","slice","el","classList","removeAttribute","setAttribute","handleInputOrChangeEvent","selectedIndex","value","bindEvents","body","addEventListener","updateAllCandidates","Array","forEach","call","querySelectorAll","node","window","documentElement","className","self","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement","parentElement","dispatchEvent","MutationObserver","mutationsList","mutation","addedNodes","nodeType","observe","childList","subtree","handleOnLoad"],"mappings":"YAAA,IAAMA,EAAwB,CAC7B,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAGc,SAASC,mBAAmBC,GAI1C,IAHA,IAAIC,GAAU,EAGLC,EAAI,EAAGC,EAASL,EAAsBK,OAAQD,EAAIC,GAAUF,EAASC,IACzEF,EAASI,QAAQN,EAAsBI,KAAO,IACjDD,GAAU,GAIZ,OAAOA,CACR,CCpBA,IAAMI,EAAmB,kBAGzB,SAASC,qBAAqBC,GAC7B,MAAyB,UAArBA,EAAQC,UAA6C,WAArBD,EAAQC,UAA8C,aAArBD,EAAQC,QAK9E,CAEA,SAASC,eAAeC,GACvB,IAAIC,EASJ,MAPsB,mBAAXC,MACVD,EAAQ,IAAIC,MAAMF,EAAW,CA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B,OAAOP,iBAAiB,mBAAoByB,EAC7C,CACD,ECtKE,iBAAoBlB,QAAUA,QAAU,iBAAoBG,MAAQA,MAAQ,IADtE9B,mBAAqBA"}
|
package/dist/browser.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.cjs","sources":["../src/is-valid-replacement.mjs","../src/browser.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement
|
|
1
|
+
{"version":3,"file":"browser.cjs","sources":["../src/is-valid-replacement.mjs","../src/browser.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement);\n\n\t// conditionally update all form control elements\n\tupdateAllCandidates();\n\n\tif (typeof self.MutationObserver !== 'undefined') {\n\t\t// conditionally observe added or unobserve removed form control elements\n\t\tnew MutationObserver(mutationsList => {\n\t\t\tmutationsList.forEach(mutation => {\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tmutation.addedNodes || [],\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && isFormControlElement(node)) {\n\t\t\t\t\t\t\thandler({ target: node });\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t}).observe(document, { childList: true, subtree: true });\n\t} else {\n\t\tconst handleOnLoad = () => updateAllCandidates();\n\n\t\twindow.addEventListener('load', handleOnLoad);\n\t\twindow.addEventListener('DOMContentLoaded', handleOnLoad);\n\t}\n}\n"],"names":["INVALID_SELECTOR_CHAR","isValidReplacement","selector","isValid","i","length","indexOf","CSS_CLASS_LOADED","isFormControlElement","element","nodeName","createNewEvent","eventName","event","Event","bubbles","document","createEvent","initEvent","observeValueOfHTMLElement","HTMLElement","handler","descriptor","Object","getOwnPropertyDescriptor","prototype","nativeSet","set","apply","this","arguments","target","defineProperty","cssBlankPseudoInit","opts","options","force","replaceWith","Error","querySelector","ignoredError","remove","add","slice","el","classList","removeAttribute","setAttribute","handleInputOrChangeEvent","selectedIndex","value","bindEvents","body","addEventListener","updateAllCandidates","Array","forEach","call","querySelectorAll","node","window","documentElement","className","self","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement","parentElement","dispatchEvent","MutationObserver","mutationsList","mutation","addedNodes","nodeType","observe","childList","subtree","handleOnLoad"],"mappings":"AAAA,IAAMA,EAAwB,CAC7B,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,K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2EzDgC,IAEqC,oBAA1BS,KAAKO,iBAEf,IAAIA,kBAAiB,SAAAC,GACpBA,EAAcf,SAAQ,SAAAgB,GACrBjB,MAAM9B,UAAU+B,QAAQC,KACvBe,EAASC,YAAc,IACvB,SAAAd,GACuB,IAAlBA,EAAKe,UAAkBlE,qBAAqBmD,IAC/CtC,EAAQ,CAAEU,OAAQ4B,GAEpB,GAEF,GACD,IAAGgB,QAAQ3D,SAAU,CAAE4D,WAAW,EAAMC,SAAS,QAC3C,CACN,IAAMC,EAAe,SAAfA,eAAY,OAASxB,GAAqB,EAEhDM,OAAOP,iBAAiB,OAAQyB,GAChClB,OAAOP,iBAAiB,mBAAoByB,EAC7C,CACD"}
|
package/dist/browser.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.mjs","sources":["../src/is-valid-replacement.mjs","../src/browser.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement
|
|
1
|
+
{"version":3,"file":"browser.mjs","sources":["../src/is-valid-replacement.mjs","../src/browser.js"],"sourcesContent":["const INVALID_SELECTOR_CHAR = [\n\t' ', // Can't use child selector\n\t'>', // Can't use direct child selector\n\t'~', // Can't use sibling selector\n\t':', // Can't use pseudo selector\n\t'+', // Can't use adjacent selector\n\t'@', // Can't use at\n\t'#', // Can't use id selector\n\t'(', // Can't use parenthesis\n\t')', // Can't use parenthesis\n];\n\nexport default function isValidReplacement(selector) {\n\tlet isValid = true;\n\n\t// Purposely archaic so it's interoperable in old browsers\n\tfor (let i = 0, length = INVALID_SELECTOR_CHAR.length; i < length && isValid; i++) {\n\t\tif (selector.indexOf(INVALID_SELECTOR_CHAR[i]) > -1) {\n\t\t\tisValid = false;\n\t\t}\n\t}\n\n\treturn isValid;\n}\n","/* global document,window,self,MutationObserver */\nimport isValidReplacement from './is-valid-replacement.mjs';\n\nconst CSS_CLASS_LOADED = 'js-blank-pseudo';\n\n// form control elements selector\nfunction isFormControlElement(element) {\n\tif (element.nodeName === 'INPUT' || element.nodeName === 'SELECT' || element.nodeName === 'TEXTAREA') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction createNewEvent(eventName) {\n\tlet event;\n\n\tif (typeof(Event) === 'function') {\n\t\tevent = new Event(eventName, { bubbles: true });\n\t} else {\n\t\tevent = document.createEvent('Event');\n\t\tevent.initEvent(eventName, true, false);\n\t}\n\n\treturn event;\n}\n\nfunction generateHandler(replaceWith) {\n\tlet selector;\n\tlet remove;\n\tlet add;\n\n\tif (replaceWith[0] === '.') {\n\t\tselector = replaceWith.slice(1);\n\t\tremove = (el) => el.classList.remove(selector);\n\t\tadd = (el) => el.classList.add(selector);\n\t} else {\n\t\t// A bit naive\n\t\tselector = replaceWith.slice(1, -1);\n\t\tremove = (el) => el.removeAttribute(selector, '');\n\t\tadd = (el) => el.setAttribute(selector, '');\n\t}\n\n\treturn function handleInputOrChangeEvent(event) {\n\t\tconst element = event.target;\n\t\tif (!isFormControlElement(element)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isSelect = element.nodeName === 'SELECT';\n\t\tconst hasValue = isSelect\n\t\t\t? !!element.options[element.selectedIndex].value\n\t\t\t: !!element.value;\n\n\t\tif (hasValue) {\n\t\t\tremove(element);\n\t\t} else {\n\t\t\tadd(element);\n\t\t}\n\t};\n}\n\n// observe changes to the \"selected\" property on an HTML Element\nfunction observeSelectedOfHTMLElement(HTMLElement) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'selected');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set(value) { // eslint-disable-line no-unused-vars\n\t\tnativeSet.apply(this, arguments);\n\n\t\tconst event = createNewEvent('change');\n\t\tthis.parentElement.dispatchEvent(event);\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'selected', descriptor);\n}\n\n// observe changes to the \"value\" property on an HTML Element\nfunction observeValueOfHTMLElement(HTMLElement, handler) {\n\tconst descriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'value');\n\tconst nativeSet = descriptor.set;\n\n\tdescriptor.set = function set() {\n\t\tnativeSet.apply(this, arguments);\n\t\thandler({ target: this });\n\t};\n\n\tObject.defineProperty(HTMLElement.prototype, 'value', descriptor);\n}\n\nexport default function cssBlankPseudoInit(opts) {\n\t// configuration\n\tconst options = {\n\t\tforce: false,\n\t\treplaceWith: '[blank]',\n\t};\n\n\tif (typeof opts !== 'undefined' && 'force' in opts) {\n\t\toptions.force = opts.force;\n\t}\n\n\tif (typeof opts !== 'undefined' && 'replaceWith' in opts) {\n\t\toptions.replaceWith = opts.replaceWith;\n\t}\n\n\tif (!isValidReplacement(options.replaceWith)) {\n\t\tthrow new Error(`${options.replaceWith} is not a valid replacement since it can't be applied to single elements.`);\n\t}\n\n\ttry {\n\t\tdocument.querySelector(':blank');\n\n\t\tif (!options.force) {\n\t\t\treturn;\n\t\t}\n\t} catch (ignoredError) { /* do nothing and continue */ }\n\n\tconst handler = generateHandler(options.replaceWith);\n\tconst bindEvents = () => {\n\t\tif (document.body) {\n\t\t\tdocument.body.addEventListener('change', handler);\n\t\t\tdocument.body.addEventListener('input', handler);\n\t\t}\n\t};\n\tconst updateAllCandidates = () => {\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll('input, select, textarea'),\n\t\t\tnode => {\n\t\t\t\thandler({ target: node });\n\t\t\t},\n\t\t);\n\t};\n\n\tif (document.body) {\n\t\tbindEvents();\n\t} else {\n\t\twindow.addEventListener('load', bindEvents);\n\t}\n\n\tif (document.documentElement.className.indexOf(CSS_CLASS_LOADED) === -1) {\n\t\tdocument.documentElement.className += ` ${CSS_CLASS_LOADED}`;\n\t}\n\n\tobserveValueOfHTMLElement(self.HTMLInputElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLSelectElement, handler);\n\tobserveValueOfHTMLElement(self.HTMLTextAreaElement, handler);\n\tobserveSelectedOfHTMLElement(self.HTMLOptionElement);\n\n\t// conditionally update all form control elements\n\tupdateAllCandidates();\n\n\tif (typeof self.MutationObserver !== 'undefined') {\n\t\t// conditionally observe added or unobserve removed form control elements\n\t\tnew MutationObserver(mutationsList => {\n\t\t\tmutationsList.forEach(mutation => {\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tmutation.addedNodes || [],\n\t\t\t\t\tnode => {\n\t\t\t\t\t\tif (node.nodeType === 1 && isFormControlElement(node)) {\n\t\t\t\t\t\t\thandler({ target: node });\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t}).observe(document, { childList: true, subtree: true });\n\t} else {\n\t\tconst handleOnLoad = () => updateAllCandidates();\n\n\t\twindow.addEventListener('load', handleOnLoad);\n\t\twindow.addEventListener('DOMContentLoaded', handleOnLoad);\n\t}\n}\n"],"names":["INVALID_SELECTOR_CHAR","isValidReplacement","selector","isValid","i","length","indexOf","CSS_CLASS_LOADED","isFormControlElement","element","nodeName","createNewEvent","eventName","event","Event","bubbles","document","createEvent","initEvent","observeValueOfHTMLElement","HTMLElement","handler","descriptor","Object","getOwnPropertyDescriptor","prototype","nativeSet","set","apply","this","arguments","target","defineProperty","cssBlankPseudoInit","opts","options","force","replaceWith","Error","querySelector","ignoredError","remove","add","slice","el","classList","removeAttribute","setAttribute","handleInputOrChangeEvent","selectedIndex","value","bindEvents","body","addEventListener","updateAllCandidates","Array","forEach","call","querySelectorAll","node","window","documentElement","className","self","HTMLInputElement","HTMLSelectElement","HTMLTextAreaElement","HTMLOptionElement","parentElement","dispatchEvent","MutationObserver","mutationsList","mutation","addedNodes","nodeType","observe","childList","subtree","handleOnLoad"],"mappings":"AAAA,IAAMA,EAAwB,CAC7B,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAGc,SAASC,mBAAmBC,GAI1C,IAHA,IAAIC,GAAU,EAGLC,EAAI,EAAGC,EAASL,EAAsBK,OAAQD,EAAIC,GAAUF,EAASC,IACzEF,EAASI,QAAQN,EAAsBI,KAAO,IACjDD,GAAU,GAIZ,OAAOA,CACR,CCpBA,IAAMI,EAAmB,kBAGzB,SAASC,qBAAqBC,GAC7B,MAAyB,UAArBA,EAAQC,UAA6C,WAArBD,EAAQC,UAA8C,aAArBD,EAAQC,QAK9E,CAEA,SAASC,eAAeC,GACvB,IAAIC,EASJ,MAPsB,mBAAXC,MACVD,EAAQ,IAAIC,MAAMF,EAAW,CAAEG,SAAS,KAExCF,EAAQG,SAASC,YAAY,UACvBC,UAAUN,GAAW,GAAM,GAG3BC,CACR,CAqDA,SAASM,0BAA0BC,EAAaC,GAC/C,IAAMC,EAAaC,OAAOC,yBAAyBJ,EAAYK,UAAW,SACpEC,EAAYJ,EAAWK,IAE7BL,EAAWK,IAAM,SAASA,MACzBD,EAAUE,MAAMC,KAAMC,WACtBT,EAAQ,CAAEU,OAAQF,QAGnBN,OAAOS,eAAeZ,EAAYK,UAAW,QAASH,EACvD,CAEe,SAASW,mBAAmBC,GAE1C,IAAMC,EAAU,CACfC,OAAO,EACPC,YAAa,WAWd,QARoB,IAATH,GAAwB,UAAWA,IAC7CC,EAAQC,MAAQF,EAAKE,YAGF,IAATF,GAAwB,gBAAiBA,IACnDC,EAAQE,YAAcH,EAAKG,cAGvBpC,mBAAm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AmB5C,GAClDF,0BAA0B4C,KAAKG,oBAAqB7C,GAlFfD,EAmFR2C,KAAKI,kBAlF5B7C,EAAaC,OAAOC,yBAAyBJ,EAAYK,UAAW,YACpEC,EAAYJ,EAAWK,IAE7BL,EAAWK,IAAM,SAASA,IAAIuB,GAC7BxB,EAAUE,MAAMC,KAAMC,WAEtB,IAAMjB,EAAQF,eAAe,UAC7BkB,KAAKuC,cAAcC,cAAcxD,IAGlCU,OAAOS,eAAeZ,EAAYK,UAAW,WAAYH,GA2EzDgC,IAEqC,oBAA1BS,KAAKO,iBAEf,IAAIA,kBAAiB,SAAAC,GACpBA,EAAcf,SAAQ,SAAAgB,GACrBjB,MAAM9B,UAAU+B,QAAQC,KACvBe,EAASC,YAAc,IACvB,SAAAd,GACuB,IAAlBA,EAAKe,UAAkBlE,qBAAqBmD,IAC/CtC,EAAQ,CAAEU,OAAQ4B,GAEpB,GAEF,GACD,IAAGgB,QAAQ3D,SAAU,CAAE4D,WAAW,EAAMC,SAAS,QAC3C,CACN,IAAMC,EAAe,SAAfA,eAAY,OAASxB,GAAqB,EAEhDM,OAAOP,iBAAiB,OAAQyB,GAChClB,OAAOP,iBAAiB,mBAAoByB,EAC7C,CACD"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-blank-pseudo",
|
|
3
3
|
"description": "Style form elements when they are empty",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -17,11 +17,17 @@
|
|
|
17
17
|
"email": "jonathantneal@hotmail.com"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
-
"license": "
|
|
21
|
-
"funding":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
"license": "MIT-0",
|
|
21
|
+
"funding": [
|
|
22
|
+
{
|
|
23
|
+
"type": "github",
|
|
24
|
+
"url": "https://github.com/sponsors/csstools"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"type": "opencollective",
|
|
28
|
+
"url": "https://opencollective.com/csstools"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
25
31
|
"engines": {
|
|
26
32
|
"node": "^14 || ^16 || >=18"
|
|
27
33
|
},
|
|
@@ -51,27 +57,22 @@
|
|
|
51
57
|
"dist"
|
|
52
58
|
],
|
|
53
59
|
"dependencies": {
|
|
54
|
-
"postcss-selector-parser": "^6.0.
|
|
60
|
+
"postcss-selector-parser": "^6.0.13"
|
|
55
61
|
},
|
|
56
62
|
"peerDependencies": {
|
|
57
63
|
"postcss": "^8.4"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
|
60
|
-
"
|
|
66
|
+
"@csstools/postcss-tape": "*",
|
|
67
|
+
"puppeteer": "^20.7.4"
|
|
61
68
|
},
|
|
62
69
|
"scripts": {
|
|
63
|
-
"prebuild": "npm run clean",
|
|
64
70
|
"build": "rollup -c ../../rollup/default.mjs",
|
|
65
|
-
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
|
|
66
71
|
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
|
|
67
|
-
"lint": "
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
71
|
-
"test": "node .tape.mjs && npm run test:exports && npm run test:invalid-replacement",
|
|
72
|
+
"lint": "node ../../.github/bin/format-package-json.mjs",
|
|
73
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
74
|
+
"test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs && node ./test/_valid-replacements.mjs",
|
|
72
75
|
"test:browser": "node ./test/_browser.mjs",
|
|
73
|
-
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs",
|
|
74
|
-
"test:invalid-replacement": "node ./test/_valid-replacements.mjs",
|
|
75
76
|
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs"
|
|
76
77
|
},
|
|
77
78
|
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/css-blank-pseudo#readme",
|