AEM Sightly-是否可以创建自定义数据欺骗属性? [英] AEM Sightly - Is it possible to create custom data-sly attributes?

查看:83
本文介绍了AEM Sightly-是否可以创建自定义数据欺骗属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以创建自定义属性,例如:

I was wondering if there is a way to create custom attributes, e.g.:

   <div data-sly-myAttribute="${whatever}"></div>

就像自定义JSP标签一样。

Just like custom JSP tags.

编辑

根据此博客
是否有任何新闻?

As of May 4, 2014, it was not possible, according to this blog. Is there any news on this?

推荐答案

否,自该实现以来无法创建自己的块元素将不符合规格[0]。不仅仅是添加一个新插件,还涉及更多的微妙之处,其中之一是当在同一HTML元素上使用多个块时,块元素优先。更不用说一个事实,如果有可能,那么什么都不会阻止您覆盖提供的插件。

No, it's not possible to create your own block elements since that implementation will not conform to the specification [0]. There are more subtleties involved than just adding a new plugin, one of them being block elements priority when multiple blocks are used on the same HTML element; not to mention the fact that if this was possible nothing would stop you from overriding the provided plugins.

但是,如果您认为需要一个新的block元素,那么请发送带有明确定义用例的对规范的拉取请求。此外,如果您在Apache Sling开发邮件列表[1]上讨论用例,可能会有所帮助-也许您所需要的是其他开发人员也考虑过的,在这种情况下,协作无疑有助于找到最佳解决方案

However, if you think that there's a need for a new block element then please send a pull request to the specification, with a well defined use case. Furthermore, it would probably help if you'd discuss your use case on the Apache Sling development mailing list [1] - maybe what you need is something that other developers have thought of as well, in which case collaboration definitely helps finding the best solution to the problem.

[0]- https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/1.2/SPECIFICATION.md

[1]- https://sling.apache.org/project-information.html#mailing-lists

这篇关于AEM Sightly-是否可以创建自定义数据欺骗属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆