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
No check of overwriting id attribute for dynamic snippets #242
Comments
dg
added a commit
to nette/latte
that referenced
this issue
Jan 3, 2020
dg
added a commit
to nette/latte
that referenced
this issue
Jan 3, 2020
dg
added a commit
to nette/latte
that referenced
this issue
Jan 3, 2020
Fixed. You can change snippet's HTML attribute this way: final class SomePresenter extends Presenter
{
public function templatePrepareFilters($template): void
{
$template->getLatte()->getCompiler()->getMacros()['snippet'][0]->snippetAttribute = 'data-snippet';
}
} I know this is a very complicated way, but there must first be some discussion of how to change it in order to not disrupt the function of components that rely on the original attribute name. |
😮 That's crazy, but I understand. Thank you for the fix anyway! |
dg
added a commit
to nette/union
that referenced
this issue
Mar 3, 2021
…e with snippet id [Closes nette/application#242]
dg
added a commit
to nette/union
that referenced
this issue
Mar 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version: 3.0.2
Bug Description
When I set up my own
id
attribute on an HTML element which also holdsn:snippet
attribute with dynamic name ('snippet-post' . $post->id
), it turns up that a check which is implemented for static snippets is not triggered in case of dynamic ones.That leads to obscure situations when rerendering of snippets suddenly stops working and you wonder how it is possible when you just added
id
attribute to HTML (!) and do not know under-the-hood of snippets.Steps To Reproduce
Use this code and see that the date is not changing when hitting the button:
Expected Behavior
Shout the same thing as on static snippets.
Possible Solution
Actually using
id
attribute to handle snippet is not clean/semantic solution.id
attribute is too generic and can be used by anyone with access to DOM so it should be frontendist's privilege to decide what it will be used for and how and backend should not/must not force its own usage. I understand that it came from time of HTML 4, but it should be reconsidered now.I suggest to take advantage of
data-*
attribute and set up custom attribute something likedata-nette-snippetId
which is sure enough not to be collided with anyone else's interest.The text was updated successfully, but these errors were encountered: