Closed StarpTech closed 6 years ago
I think that wouldn’t work for things like id
, where the prop is equal to the attribute.
What would work is info.space === undefined && info.property === info.attribute && info.property !== 'role'
, because everything except for ARIA has a namespace attached, and ARIA always has different casing, except for role
.
I’m OK with something like unknown, but don’t like that word. data
properties are all “unknown”, but they are still handled properly!
I think you mean
!info.space && info.property === info.attribute && info.property !== 'role'
space
is just not set in that case.
What's your suggestion for the name?
space is just not set in that case.
not defined and explicitly set to undefined both evaluate to undefined!
What's your suggestion for the name?
not sure 🤔 do you have suggestions?
not defined and explicitly set to undefined both evaluate to undefined!
That's true but not in this case. The property is on the prototype and does exist.
'space' in info // true
Correct would be
info.space === null &&
info.property === info.attribute &&
info.property !== 'role'
Ah, I totes forgot about the prototype. Good catch!
What still remains is how to call the prop! 🤷♂️
not sure 🤔 do you have suggestions?
e.g
external: true
custom: true
userDefined: true
How about specified
, as in, it’s specified by a spec (or not)?
Others:
defined
known
(we discussed unknown
)(I think I’d rather not have double negatives, I prefer defined: true
instead of undefined: false
)
I think 🤔 specified
is great :+1:
Alternatively still defined
, as it’s shorter and people type it a lot (because of undefined). Or even found
, as the primary way to get these Info object is through .find()
.
Anyway, feel free to pick one and create a PR. We can easily replace a word with something else when we have some actual code!
Allright, I will create a PR soon.
I think it's better to opt-out this property because it only affects custom properties. Do you have a better name for this? specified
or defined
would affect all known attributes.
WDYT about custom
(like custom element/attribute) or just new
?
We could add it to the prototype, and potentially also create an UnspecifiedProperty
with specified: false
or so?
or DefinedProperty
/ UndefinedProperty
, etc etc
Hi, I need to check if an attribute is a known HTML attribute or not. I do it in this way:
I think it would be good to provide a flag like
unknown: true