-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Attribute capture
treated as boolean outside of HTMLInputElement
context
#20
Comments
capture
treated as boolean outside of HTMLInputElement
contextcapture
treated as boolean outside of HTMLInputElement
context
Please provide information on what you are doing. Actual code to reproduce an issue |
In a private project have a custom element (defined as Lit element) named It defines attributes, among which there's <!-- (…) -->
<w-search-params-provider capture="foo, bar,baz" /> What it means in context of this component is: "take the values of URL search params named I process such piece of HTML with I narrowed it down to this line: const attrs = serializeAttributes(state, node.properties) and 2-3 hops away there's const info = find(state.schema, key) and that comes from Then there's if (info.overloadedBoolean && (value === info.attribute || value === '')) {
value = true
} else if (
info.boolean ||
(info.overloadedBoolean && typeof value !== 'string')
) {
value = Boolean(value)
} Now when I looked into this last one I see the concept of EDIT: no, property-information/readme.md Lines 226 to 229 in a9fcef7
|
Thanks for providing info. This project is from 2015. Custom elements are much more recent. This project here does not care about tag names. It’s a general, global, list of how HTML works. Adding support for knowing about elements could be interesting, but is involved. Perhaps it’s a better solution though. Is there any reason you think there is a bug in |
Right, I get it.
May it be that a given attribute works differently for one HTML element or elements, and differently for other? I see that originally might - I guess - be about Line 61 in cb286d4
But now it's described as related to HTML Media Capture: Lines 123 to 125 in a9fcef7
And
I tracked it becoming a DOMString at 2017-08-31: https://www.w3.org/TR/2017/CR-html-media-capture-20170831/#status-of-this-document Actual fragment: https://github.com/w3c/html-media-capture/blob/88efb33a0f8c4509d6f7c41a8492ae048f74a810/releases/CR4.html#L965-L976 but it's a change from enumeration https://www.w3.org/TR/2017/CR-html-media-capture-20170504/#dom-capturefacingmode, not from a boolean, but lack of value was also allowed by that enumeration:
My guess is that the definition in here just doesn't keep up with the standard which was very new at the time |
Not before. Stuff like That being said, when some random string is used for
The source of this data originally is React. Which works with virtual DOMs. Some things need to be set as DOM properties and some as attributes. Over the years, the data specific to virtual DOM use cases was removed.
|
For now I decided to just raname the attribute of the custom element, which I happen to be not only the consumer but also an author of 😅, but I'll check and I'll come back with whether it helps with change reverted or not The question of My guess is that they will either work as they used to or they will both work that way and be treated as any other inputs - it will depend on the internals of the custom element how it reads inputs. It's a It's pretty clear that one may not try to alter behavior of Same is in case of using attributes which may later become defined: in my case it was like this, that I wasn't even aware of existence of |
👍 There is also the case where custom elements can “inherit” from a particular element. You can make a For the global attributes, yes, There’s always |
I noticed that
rehype
(usinghast-util-to-html
andproperty-information
ultimately) wipes out value of attributecapture
(because it's considered a boolean attribute)property-information/lib/html.js
Line 41 in a9fcef7
but it happens on custom element.
I believe that should not be the case.
Attribute
capture
is defined forinput
(https://w3c.github.io/html-media-capture/#the-capture-idl-attribute), but the custom element I use it on assigns a different meaning to it.If it's possible to configure
hast-util-to-html
orrehype
so they know what are the supported attributes of a given custom element - please let me know, but either way I think thatproperty-information
should only considercapture
as boolean attribute in elements that it's defined onThe text was updated successfully, but these errors were encountered: