-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Element Naming Conventions #86
Comments
@brandondees I think we should have the following in the "Conventions" docs. VERBATIM even: @robcole looks like we have access to By the way... notice emoticons can be used as a valid name |
is it best to namespace all snuggsi elements by default? or better to prescribe a default convention of app-namespacing all custom elements etc? i am going to go ahead and presume that for redistributable components namespacing should be an obvious best practice (import and and to use them side by side in an app, but the namespace way) |
should namespaces be human-meaningful / semantic? or is strictly programmatic better? (i'm looking at HTML id vs name attrs for comparison) |
@robcole & @tmornini would probably have better input on this @brandondees. He sparked the idea so interested in opinion. I'm just an implementor. ;-) Probably best to review references: In a way this makes sense of S3 buckets. @tmornini and i discussed once how the "URL paths" are merely namespaces where the delimiter just so happens to be |
@robcole @brandondees well there goes that theory of I think we can move on to "bonafied" namespacing. |
@brandondees @robcole @kurtcagle seems to have been a discussion to try to get hyphen removed. I agree that's a bad idea. https://discourse.wicg.io/t/custom-elements-not-requiring-hyphens-in-names/1439 |
i have no problem with the hyphen requirement, as it's only a very minor inconvenience, and having a clear rule to follow is helpful |
It also prevents using tags that might be new tags, since most base tags
are no hyphen
…On Wed, Aug 2, 2017, 10:06 AM Brandon Dees ***@***.***> wrote:
i have no problem with the hyphen requirement, as it's only a very minor
inconvenience, and having a clear rule to follow is helpful
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#86 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGaPS3XleFOERjNa3ZnZNTRmLaUjqSbpks5sUJBtgaJpZM4OO8uk>
.
|
see that whole thread for the ins and outs of the rationale for the rule, and arguments against it as well. in short, that's the main justification for the rule. |
Current API
Tasks
id
. (colon) Reference hereNaming Elements
TL;DR; use at least one hyphen
-
in tag name. (foo-
is valid as well)Below is the restriction set for custom elements naming conventions.
Suggestions
Custom elements with a single word name.
Similar to Custom HTTP Headers A convention when you don't have at least 2 words (i.e.
<foo-bar>
) would be to prefix custom element name withx-*
. (i.e.<x-input>
). That said #TodayILearned this has been deprecated in HTTP and has a bonafied spec for the deprecation So the following may be a better best practice. /cc @tmorniniNon-visual Components
Think a geo location component or a storage adapter. A Non-"Mixin" or... a "Mixin" that can be declared via HTML.
I kind of like the thought of the following:
the
<-*>
styled elements say are for "non visual" components?Would be a valid component name. Again we are just defining conventions around what's available to us within the spec.
Please note the intent is the name of the element not it's functionality.
Namespacing Elements (@snuggs + @robcole)
Had a conversation today with Rob and he discussed the need for namespacing.
I mentioned to him that in the W3C Specs and WHATWG specs they have gone out of
the way to preserve XML Namespacing due to the need to support XMLDocument parsing.
Perhaps we can borrow some conventions from there since they are already baked into the browser.
What is Namespacing
Namespacing TL;DR; example
Namespace Crash Course
"Namespaces are a means of identifying collections of reserved words of particular xml markup type so they can be combined with other markup without fear of conflict." - From this Youtube video.
It's not a "Location of something" but more a "grouping of ideas".
@tmornini especially curious of your input here on "namespacing" at a high level.
Resources and APIs
Document.createElementNS
- https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNSElement.namespaceURI
- https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURIElement.getAttributeNS
- https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNSElement.setAttributeNS
- https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNS@namespace
CSS declaration - https://developer.mozilla.org/en-US/docs/Web/CSS/@namespaceDiscussion
The text was updated successfully, but these errors were encountered: