Skip to content

Commit

Permalink
wip: log unknown property access
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Dec 17, 2022
1 parent 5fcbac8 commit b209946
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Properties.prototype.set = function(target, name, value) {

var property = this.model.getPropertyDescriptor(target, name);

verifyAccess(target, property, name);

var propertyName = property && property.name;

if (isUndefined(value)) {
Expand Down Expand Up @@ -68,6 +70,8 @@ Properties.prototype.get = function(target, name) {

var property = this.model.getPropertyDescriptor(target, name);

verifyAccess(target, property, name);

if (!property) {
return target.$attrs[name];
}
Expand Down Expand Up @@ -135,4 +139,14 @@ function defineProperty(target, property, value) {
value: value,
configurable: true
});
}

function verifyAccess(target, property, name) {

if (name.includes(':') || property) {
return;
}

// eslint-disable-next-line no-undef
typeof console !== 'undefined' && console.warn(`unknown property <${ name }> on element`, target);
}

0 comments on commit b209946

Please sign in to comment.