fix(input): copy custom attrs from ion-input to native input

This commit is contained in:
Adam Bradley
2016-02-01 21:57:26 -06:00
parent 015361d5c0
commit 4cfe210a5a
4 changed files with 31 additions and 3 deletions

View File

@@ -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) => {