Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/libs/isInputAutoFilled.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import isSelectorSupported from './isSelectorSupported';

/**
* Check the input is auto filled or not
* @param {Object} input
* @return {Boolean}
*/
export default function isInputAutoFilled(input) {
if (!input.matches) return false;
return input.matches(':-webkit-autofill') || input.matches(':autofill');
if (isSelectorSupported(':autofill')) {
return input.matches(':-webkit-autofill') || input.matches(':autofill');
}
return input.matches(':-webkit-autofill');
}
13 changes: 13 additions & 0 deletions src/libs/isSelectorSupported/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Check platform supports the selector or not
* @param {String} selector
* @return {Boolean}
*/
export default function isSelectorSupported(selector) {
try {
document.querySelector(selector);
return true;
} catch (error) {
return false;
}
}
4 changes: 4 additions & 0 deletions src/libs/isSelectorSupported/index.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Native platforms do not support the selector
export default function isSelectorSupported() {
return false;
}