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

'data-gs-min-width' to 'gs-min-w' attr rename #1492

Merged
merged 1 commit into from
Nov 29, 2020

Conversation

adumesny
Copy link
Member

@adumesny adumesny commented Nov 29, 2020

Description

  • removed 'data-' from all attributes (legacy JS style) and shorten width/height to w/h
  • make for smaller and more efficient code and CSS.
    Easy enough to global replace in your code.

Checklist

  • Created tests which fail without the change (if possible)
  • All tests passing (yarn test)
  • Extended the README / documentation, if necessary

* removed 'data-' from all attributes (legacy JS style) and shorten width/height to w/h
* make for smaller and more efiicient code and CSS.
Easy enough to global replace in your code.
@adumesny adumesny merged commit d6922d3 into gridstack:develop Nov 29, 2020
@flawedvice
Copy link

I'm using gridstack.js along with TypeScript and SvelteKit, but if I try to add custom attributes like gs-w, TypeScript complains:

Screenshot from 2023-02-13 12-24-33

It works fine though, but the error is annoying.

I also noticed that the error disappears when prefixing the attribute with data-, as it's a "valid HTML attribute" for TS.

Is there anything one can do to bypass this?

@adumesny
Copy link
Member Author

@flawedvice I don't know sveltekit but this works in regular html as documented <div class="grid-stack-item" gs-w="2"> and for the Angular framework this is what I use [attr.gs-w]="2"

@flawedvice
Copy link

Surely it has to do with Svelte's types for HTML elements. What actually worked for me, and hopefully for others who might have the same problem, is to use the spread operator over the attributes:

image

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

Successfully merging this pull request may close these issues.

None yet

2 participants