focus-within-polyfill
Advanced tools
Comparing version 3.0.1 to 3.1.0
!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((o=o||self).focusWithin={})}(this,function(o){"use strict";var e,n;function t(o){var n,t;t||(window.requestAnimationFrame(function(){if(n=document.activeElement,t=!1,Array.prototype.slice.call(document.getElementsByClassName(e)).forEach(function(o){o.classList.remove(e)}),"focus"===o.type&&n&&n!==document.body)for(var i=n;i&&1===i.nodeType;i=i.parentNode)i.classList.add(e)}),t=!0)}o.loadPolyfill=function(o){!function(o){return"string"!=typeof o?(console.error("focus-within-polyfill:"+o+" is not a string"),!1):/[\s]/.test(o)?(console.error('focus-within-polyfill: class name "className" cannot contain white spaces.'),!1):/-?[_a-zA-Z]+[_-a-zA-Z0-9]*/.test(o)}(e=o||"focus-within")?console.warn("focus-within-polyfill: cannot load. "+e+" is not a valid class name"):n||function(){try{return document.querySelector(":focus-within"),console.info("focus-within-polyfill: focus-within supported"),!0}catch(o){return console.info("focus-within-polyfill: focus-within not supported"),!1}}()||(document.addEventListener("focus",t,!0),document.addEventListener("blur",t,!0),n=!0,console.info("focus-within-polyfill: loaded."))},o.unloadPolyfill=function(){n?(document.removeEventListener("focus",t,!0),document.removeEventListener("blur",t,!0),n=!1,console.info("focus-within-polyfill: unloaded.")):console.warn("focus-within-polyfill: cannot unload. Polyfill was never loaded.")},Object.defineProperty(o,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=focus-within-polyfill.js.map |
112
package.json
{ | ||
"name": "focus-within-polyfill", | ||
"version": "3.0.1", | ||
"description": "focus-within pseudo selector polyfill", | ||
"main": "dist/focus-within-polyfill.js", | ||
"module": "dist/focus-within-polyfill.mjs", | ||
"jsnext:main": "dist/focus-within-polyfill.mjs", | ||
"scripts": { | ||
"build": "rollup -c rollup.config.js --environment BUILD:production", | ||
"watch": "rollup -c rollup.config.js --environment BUILD:development -w", | ||
"preversion": "npm test", | ||
"version": "npm run build", | ||
"postversion": "git push && git push --tags", | ||
"prepublish": "npm run build", | ||
"test": "echo \"Error: no test specified\" && exit 0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/matteobad/focus-within-polyfill" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/matteobad/focus-within-polyfill/issues" | ||
}, | ||
"keywords": [ | ||
"polyfill", | ||
"focus", | ||
"blur", | ||
"focus-within", | ||
"pseudo-class", | ||
"no-jquery", | ||
"vanilla", | ||
"vanilla-js" | ||
], | ||
"author": "Matteo Badini", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"rollup": "^1.10.1", | ||
"rollup-plugin-eslint": "^5.1.0", | ||
"rollup-plugin-terser": "^4.0.4" | ||
}, | ||
"browserslist": [ | ||
"defaults" | ||
] | ||
"name": "focus-within-polyfill", | ||
"version": "3.1.0", | ||
"description": "focus-within pseudo selector polyfill", | ||
"main": "dist/focus-within-polyfill.js", | ||
"module": "dist/focus-within-polyfill.mjs", | ||
"jsnext:main": "dist/focus-within-polyfill.mjs", | ||
"scripts": { | ||
"commit": "git-cz", | ||
"clean": "rimraf dist", | ||
"lint": "eslint src test", | ||
"build": "rollup -c rollup.config.js --environment BUILD:production", | ||
"watch": "rollup -c rollup.config.js --environment BUILD:development -w", | ||
"prepublishOnly": "npm run clean && npm run lint && npm run test && npm run build", | ||
"upgrade": "npm-check --update", | ||
"test": "echo \"Error: no test specified\" && exit 0", | ||
"semantic-release": "semantic-release" | ||
}, | ||
"homepage": "https://github.com/matteobad/focus-within-polyfill#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/matteobad/focus-within-polyfill" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/matteobad/focus-within-polyfill/issues" | ||
}, | ||
"keywords": [ | ||
"polyfill", | ||
"focus", | ||
"blur", | ||
"focus-within", | ||
"pseudo-class", | ||
"no-jquery", | ||
"vanilla", | ||
"vanilla-js" | ||
], | ||
"author": "Matteo Badini", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@semantic-release/changelog": "^3.0.2", | ||
"@semantic-release/commit-analyzer": "^6.1.0", | ||
"@semantic-release/git": "^7.0.8", | ||
"@semantic-release/npm": "^5.1.4", | ||
"@semantic-release/release-notes-generator": "^7.1.4", | ||
"commitizen": "^3.1.1", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"eslint": "^5.16.0", | ||
"husky": "^2.1.0", | ||
"npm-check": "^5.9.0", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.10.1", | ||
"rollup-plugin-eslint": "^5.1.0", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"semantic-release": "^15.13.3", | ||
"standard": "^12.0.1" | ||
}, | ||
"browserslist": [ | ||
"defaults" | ||
], | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint && npm run test" | ||
} | ||
} | ||
} |
@@ -44,2 +44,6 @@ # `:focus-within` Pseudo-Class Polyfill | ||
## Notes | ||
This polyfill does not support shadow DOM. The goal is to polyfill a feature that is missing in IE and EDGE and since shadow DOM is another feature that [needs polyfilling](https://caniuse.com/#feat=shadowdomv1) in this browser I won't implement such feature, but any PR is well accepted. | ||
## Browser Support | ||
@@ -46,0 +50,0 @@ |
@@ -0,0 +0,0 @@ import { supportsFocusWithin, validClassName } from './utils' |
@@ -22,3 +22,3 @@ /** | ||
export function validClassName(className) { | ||
if (typeof className !== 'string') { | ||
if (typeof className !== 'string') { | ||
console.error('focus-within-polyfill:' + className + ' is not a string') | ||
@@ -25,0 +25,0 @@ return false |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
16
100
1
56
21150
16