Could you please explain your intended use case with a concrete example?
Where and when do you want to access the element attributes, and what do you want to then do with them? As it stands, the question posed is to vague to be answered. You mention a wiki command but surely you don’t mean node.js commands?
Thanks for reply! “Command” might be the wrong term, I just mean an invocation to “do” something (in this case extract the values) in the wikitext, such as <$widget... or <<macro... etc. “Transclude” the attribute value, if you will.
A concrete example showed up in scrolly: The user must wrap his to-be-scrolled text in the custom html element <scrollbar> and I want the user to be able to specify there what height the construct should have, like e.g so <scrollbar height=50vh>. Currently, the height is hard coded in the accompanying stylesheet, including sizes for subsequent items in the style defs that depend on the outer height.
BTW, maybe there already exists a mechanism in TW to read data-* attribute values used in Custom styles by data-tags ?
This example isn’t as clear to me as you might imagine. I understand the user requirement to specify a height, however it still isn’t clear where you want to later access this height and what you want to do with it. Do you want to access it in a stylesheet? If so, how would you know which instance of you want to retrieve properties from? Or do you want to use the user specified attribute to set a style attribute on the element itself? Or on another element?
The chances that I have done work in the area that interests you seems pretty high, however it is impossible to be of further help without understanding what you are trying to do. Do you perhaps want to set a CSS variable via an element attribute and then use that variable to set CSS values within that element?
Again, read the attribute where and when, and in order to use how? Is it in an action string? In a stylesheet? In a filtered transclusion to assign an element attribute?
Edit: the custom tag approach makes me think you would be well served by the parametrized transclusion work. The user could specify a value as a widget attribute and it could be available as a variable everywhere within that widget to use as necessary.
Yes, I have only considered that it would be the stylesheet that should access it (but, of course, now that you ask I can’t help but wonder if it would be useful elsewhere? …but that is not what I have in mind currently)
And yes, only the element wherein the user states the value should be affected.
P.S I note @telumire 's reply so I will try it out before it is worth bothering more with the OP. It might suffice. Thanks @telumire