Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property name starting from "data" is recognized as data-* attribute #1016

Open
web-padawan opened this issue Mar 31, 2017 · 3 comments
Open

Comments

@web-padawan
Copy link
Contributor

I get this error in several cases:

[set-unknown-attribute] - data-* attributes must be accessed as attributes. 
i.e. you must write:  data-for-export$="{{dataForExport}}"

As of now, Polymer 1.x accepts such properties, though. They don't get reflected into attributes, neither are they being put into dataset.

Would it be disallowed by 2.0 release? Should we avoid such names?
If so, having this documented would be nice.
If not, I'd expect not to see those errors at all.

@rictic
Copy link
Contributor

rictic commented Mar 31, 2017

So, this is in that category of legal but suspicious code, as the user may be trying to interact with dataset, and would be surprised when that doesn't happen.

Most lint warnings do have some false negatives, as there's a lot of wrong code that won't throw.

OTOH, it may be more common to have dataFoo properties than to intentionally use the dataset field. I'm not sure that it actually sees much real world use?

Hm, oh! If there's a known property like dataForExport that you're setting, then we should not warn. Only if it's an unknown property and it starts with data- should we give the special warning about data-* attributes.

Ok, cool, yeah that should work.

Thanks for filing these bugs btw!

@aomarks aomarks transferred this issue from Polymer/polymer-linter Jan 3, 2019
@davidmaxwaterman
Copy link

An example of such a false positive is vaadin-grid which has a dataProvider property. I almost incorrected this when it was flagged up by the linter :/

...but, yeah, so old now surely no one is going to bother fixing it.

@stale
Copy link

stale bot commented Dec 23, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

4 participants