css-blank-pseudo
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,1 +0,1 @@ | ||
function cssBlankPseudo(e,t){var r=Object(t).className,n=Object(t).attr||"blank",o=Object(t).force;try{if(e.querySelector(":blank"),!o)return}catch(e){}c(HTMLInputElement),c(HTMLSelectElement),c(HTMLTextAreaElement);var a="input,select,textarea";function s(){this.value?(n&&this.removeAttribute(n),r&&this.classList.remove(r),this.removeAttribute("blank")):(n&&this.setAttribute("blank",n),r&&this.classList.add(r))}function c(e){var t=Object.getOwnPropertyDescriptor(e.prototype,"value"),r=t.set;t.set=function(e){r.apply(this,arguments),s.apply(this)},Object.defineProperty(e.prototype,"value",t)}Array.prototype.forEach.call(e.querySelectorAll(a),function(e){e.addEventListener("input",s),s.call(e)}),new MutationObserver(function(e){e.forEach(function(e){e.addedNodes&&e.addedNodes.forEach(function(e){1===e.nodeType&&e.matches(a)&&(e.addEventListener("input",s),s.call(e))}),e.removedNodes&&e.removedNodes.forEach(function(e){1===e.nodeType&&e.matches(a)&&e.removeEventListener("input",s)})})}).observe(e,{childList:!0,subtree:!0})} | ||
function cssBlankPseudo(e,t){var r=Object(t).className,n=Object(t).attr||"blank",o=Object(t).force;try{if(e.querySelector(":blank"),!o)return}catch(e){}var a=(e.ownerDocument||e).defaultView;i(a.HTMLInputElement),i(a.HTMLSelectElement),i(a.HTMLTextAreaElement);var c="input,select,textarea";function s(){this.value?(n&&this.removeAttribute(n),r&&this.classList.remove(r),this.removeAttribute("blank")):(n&&this.setAttribute("blank",n),r&&this.classList.add(r))}function i(e){var t=Object.getOwnPropertyDescriptor(e.prototype,"value"),r=t.set;t.set=function(e){r.apply(this,arguments),s.apply(this)},Object.defineProperty(e.prototype,"value",t)}Array.prototype.forEach.call(e.querySelectorAll(c),function(e){e.addEventListener("input",s),s.call(e)}),new MutationObserver(function(e){e.forEach(function(e){e.addedNodes&&e.addedNodes.forEach(function(e){1===e.nodeType&&e.matches(c)&&(e.addEventListener("input",s),s.call(e))}),e.removedNodes&&e.removedNodes.forEach(function(e){1===e.nodeType&&e.matches(c)&&e.removeEventListener("input",s)})})}).observe(e,{childList:!0,subtree:!0})} |
# Changes to CSS Blank Pseudo | ||
### 0.1.2 (November 17, 2018) | ||
- Provide a version specifically for Internet Explorer 11 | ||
### 0.1.1 (November 17, 2018) | ||
@@ -4,0 +8,0 @@ |
@@ -20,5 +20,6 @@ 'use strict'; | ||
observeValueOfHTMLElement(HTMLInputElement); | ||
observeValueOfHTMLElement(HTMLSelectElement); | ||
observeValueOfHTMLElement(HTMLTextAreaElement); // form control elements selector | ||
const window = (document.ownerDocument || document).defaultView; | ||
observeValueOfHTMLElement(window.HTMLInputElement); | ||
observeValueOfHTMLElement(window.HTMLSelectElement); | ||
observeValueOfHTMLElement(window.HTMLTextAreaElement); // form control elements selector | ||
@@ -25,0 +26,0 @@ const selector = 'input,select,textarea'; // conditionally update all form control elements |
{ | ||
"name": "css-blank-pseudo", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Style form elements when they are empty", | ||
@@ -17,2 +17,3 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"browser.js", | ||
"browser-legacy.js", | ||
"cli.js", | ||
@@ -23,2 +24,6 @@ "index.js", | ||
"index.mjs.map", | ||
"legacy.js", | ||
"legacy.js.map", | ||
"legacy.mjs", | ||
"legacy.mjs.map", | ||
"postcss.js", | ||
@@ -31,6 +36,6 @@ "postcss.js.map", | ||
"build": "npm run build:browser && npm run build:cli && npm run build:node && npm run build:postcss", | ||
"build:browser": "cross-env NODE_ENV=browser rollup -c .rollup.js --silent", | ||
"build:browser": "cross-env NODE_ENV=browser rollup -c .rollup.js --silent && cross-env NODE_ENV=browser:legacy rollup -c .rollup.js --silent", | ||
"build:cli": "cross-env NODE_ENV=cli rollup -c .rollup.js --silent", | ||
"build:postcss": "cross-env NODE_ENV=postcss rollup -c .rollup.js --silent", | ||
"build:node": "rollup -c .rollup.js --silent", | ||
"build:node": "rollup -c .rollup.js --silent && cross-env NODE_ENV=legacy rollup -c .rollup.js --silent", | ||
"prepublishOnly": "npm build && npm test", | ||
@@ -37,0 +42,0 @@ "pretest": "npm run build:postcss", |
@@ -36,5 +36,15 @@ # CSS Blank Pseudo [<img src="http://jonathantneal.github.io/js-logo.svg" alt="" width="90" height="90" align="right">][CSS Blank Pseudo] | ||
That’s it. The script is 483 bytes and works in all browsers, as far back as | ||
Internet Explorer 11. | ||
That’s it. The script is 509 bytes and works in all browsers. | ||
--- | ||
If you support Internet Explorer 11, use the **browser legacy** script, which | ||
is 671 bytes: | ||
```html | ||
<link rel="stylesheet" href="TRANSFORMED.css"> | ||
<script src="https://unpkg.com/css-blank-pseudo/browser-legacy"></script> | ||
<script>cssBlankPseudo(document)</script> | ||
``` | ||
## How it works | ||
@@ -41,0 +51,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63994
19
518
94