Skip to content

Commit

Permalink
Use component.attrName that includes the name plus optional id like e…
Browse files Browse the repository at this point in the history
…vent-set__click when checking for implicit value (from mixin or primitive)
  • Loading branch information
vincentfretin committed Nov 26, 2024
1 parent b704cfa commit cdc1a89
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lib/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ function getImplicitValue(component, source) {
isInherited =
defaults &&
/* eslint-disable-next-line no-prototype-builtins */
defaults.hasOwnProperty(component.name) &&
Object.keys(defaults[component.name]).length === 0;
defaults.hasOwnProperty(component.attrName) &&
Object.keys(defaults[component.attrName]).length === 0;
Object.keys(component.schema).forEach(function (propertyName) {
var propertyValue = getFromAttribute(component, propertyName, source);
if (propertyValue === undefined) {
Expand Down Expand Up @@ -373,11 +373,11 @@ function getMixedValue(component, propertyName, source) {
for (var i = 0; value === undefined && i < reversedMixins.length; i++) {
var mixin = reversedMixins[i];
/* eslint-disable-next-line no-prototype-builtins */
if (mixin.attributes.hasOwnProperty(component.name)) {
if (mixin.attributes.hasOwnProperty(component.attrName)) {
if (!propertyName) {
value = mixin.getAttribute(component.name);
value = mixin.getAttribute(component.attrName);
} else {
value = mixin.getAttribute(component.name)[propertyName];
value = mixin.getAttribute(component.attrName)[propertyName];
}
}
}
Expand All @@ -399,11 +399,14 @@ function getInjectedValue(component, propertyName, source) {
var value;
var primitiveDefaults = source.defaultComponentsFromPrimitive;
/* eslint-disable-next-line no-prototype-builtins */
if (primitiveDefaults && primitiveDefaults.hasOwnProperty(component.name)) {
if (
primitiveDefaults &&
primitiveDefaults.hasOwnProperty(component.attrName)

Check failure on line 404 in src/lib/entity.js

View workflow job for this annotation

GitHub Actions / Test Cases (20.x)

Do not access Object.prototype method 'hasOwnProperty' from target object
) {
if (!propertyName) {
value = primitiveDefaults[component.name];
value = primitiveDefaults[component.attrName];
} else {
value = primitiveDefaults[component.name][propertyName];
value = primitiveDefaults[component.attrName][propertyName];
}
}
return value;
Expand Down

0 comments on commit cdc1a89

Please sign in to comment.