Skip to content

Commit

Permalink
get rid of $.prop(
Browse files Browse the repository at this point in the history
  • Loading branch information
ro0gr committed Jan 17, 2024
1 parent 1c55eaf commit 15cdca1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions addon/src/properties/property.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { $ } from '../-private/jquery';
import { findOne } from '../-private/finders';
import { getter } from '../macros/index';

Expand Down Expand Up @@ -52,6 +51,20 @@ export function property(propertyName, selector, userOptions = {}) {
...userOptions,
};

return $(findOne(this, selector, options)).prop(propertyName);
const element = findOne(this, selector, options);
const propName = normalizePropertyName(propertyName);

return element[propName];
});
}

const camelCaseMap = {
tabindex: 'tabIndex',
readonly: 'readOnly',
maxlength: 'maxLength',
contenteditable: 'contentEditable',
};

function normalizePropertyName(propertyName) {
return camelCaseMap[propertyName] ?? propertyName;
}

0 comments on commit 15cdca1

Please sign in to comment.