mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(input): copy custom attrs from ion-input to native input
This commit is contained in:
@@ -198,6 +198,20 @@ export function hasFocusedTextInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const skipInputAttrsReg = /^(value|checked|disabled|type|class|style|id)$/i
|
||||
export function copyInputAttributes(srcElement, destElement) {
|
||||
// copy attributes from one element to another
|
||||
// however, skip over a few of them as they're already
|
||||
// handled in the angular world
|
||||
let attrs = srcElement.attributes;
|
||||
for (let i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
if (!skipInputAttrsReg.test(attr.name)) {
|
||||
destElement.setAttribute(attr.name, attr.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let matchesFn: string;
|
||||
let matchesMethods: Array<string> = ['matches','webkitMatchesSelector','mozMatchesSelector','msMatchesSelector'];
|
||||
matchesMethods.some((fn: string) => {
|
||||
|
||||
Reference in New Issue
Block a user