Skip to content

Instantly share code, notes, and snippets.

@drewbrokke
Created June 12, 2014 17:43
Show Gist options
  • Save drewbrokke/98297123ba30d5ff8239 to your computer and use it in GitHub Desktop.
Save drewbrokke/98297123ba30d5ff8239 to your computer and use it in GitHub Desktop.
if (target.hasClass("form-builder-field-node")) {
if ((keyCode === 27) ||
(keyCode === 13 && !target.hasClass("field-textarea")) ||
(target.hasClass("field-textarea") && keyCode === 13 && event.ctrlKey === true)) {
target.ancestor(".form-builder-field").focus();
}
// if ((keyCode === 13 && !target.hasClass("field-textarea"))) {
// target.ancestor(".form-builder-field").focus();
// }
// if ((target.hasClass("field-textarea") && keyCode === 13 && event.ctrlKey === true)) {
// target.ancestor(".form-builder-field").focus();
// }
}
@marclundgren
Copy link

nate tells me that .hasClass is not a cheap call.

Mike and I did something like this in aui-datepicker:

var nodeType = node.get('nodeType');

var text = (((tagName === 'input' && type === 'text') ||(tagName === 'textarea')) && node.compareTo(document.activeElement));

https://github.com/marclundgren/alloy-ui/commit/93f796e001d9a37ba4687a4afbcc8a0b29d51a19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment